How can one draw a segment of a sphere with TikZ? [on hold] The Next CEO of Stack OverflowHow to draw arcs linking two points in TikZ?Draw arc in tikz when center of circle is specifiedHow to draw a ring-like diagram with some labels on its arcs?circle vs arch with shorten — normal or bug?The intersection of a sphere with planes through an axis tangent to the north poleTikZ: Drawing an arc from an intersection to an intersectiontikz/pgfplots - Plotting 3D surface with sphereCreate with TikZ a union of more graphsHow draw axes & figure with TikZ using “mathematician's axes”?How can I draw a circle knowing center and radius lies on a plane?

Yu-Gi-Oh cards in Python 3

How to avoid supervisors with prejudiced views?

Chain wire methods together in Lightning Web Components

Bartok - Syncopation (1): Meaning of notes in between Grand Staff

Why the difference in type-inference over the as-pattern in two similar function definitions?

How I can get glyphs from a fraktur font and use them as identifiers?

Won the lottery - how do I keep the money?

Is it ever safe to open a suspicious HTML file (e.g. email attachment)?

Find non-case sensitive string in a mixed list of elements?

Is it professional to write unrelated content in an almost-empty email?

What steps are necessary to read a Modern SSD in Medieval Europe?

Writing differences on a blackboard

What connection does MS Office have to Netscape Navigator?

Reference request: Grassmannian and Plucker coordinates in type B, C, D

How to delete every two lines after 3rd lines in a file contains very large number of lines?

Is it possible to use a NPN BJT as switch, from single power source?

Why do airplanes bank sharply to the right after air-to-air refueling?

Do I need to write [sic] when a number is less than 10 but isn't written out?

Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?

Why is the US ranked as #45 in Press Freedom ratings, despite its extremely permissive free speech laws?

Domestic-to-international connection at Orlando (MCO)

Is there a way to save my career from absolute disaster?

Can this equation be simplified further?

Proper way to express "He disappeared them"



How can one draw a segment of a sphere with TikZ? [on hold]



The Next CEO of Stack OverflowHow to draw arcs linking two points in TikZ?Draw arc in tikz when center of circle is specifiedHow to draw a ring-like diagram with some labels on its arcs?circle vs arch with shorten — normal or bug?The intersection of a sphere with planes through an axis tangent to the north poleTikZ: Drawing an arc from an intersection to an intersectiontikz/pgfplots - Plotting 3D surface with sphereCreate with TikZ a union of more graphsHow draw axes & figure with TikZ using “mathematician's axes”?How can I draw a circle knowing center and radius lies on a plane?










0















I am trying to replace the black plan with a segment of a sphere using tikz :



continuation pseudo arclength



The sphere would be of centre H(Yi) and radius ||H(Yi) , H(Yi+1_0)|| on which will lie all the points from k=0 (green point) to k (blue point) (=> corresponding to an arc of a circle in the plan designated by the axis system in the upper left corner).



Any propositions using tikz to add a part of a sphere would be greatly appreciated. Thank you.










share|improve this question









New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 1 hour ago


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 5





    welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

    – Zarko
    8 hours ago
















0















I am trying to replace the black plan with a segment of a sphere using tikz :



continuation pseudo arclength



The sphere would be of centre H(Yi) and radius ||H(Yi) , H(Yi+1_0)|| on which will lie all the points from k=0 (green point) to k (blue point) (=> corresponding to an arc of a circle in the plan designated by the axis system in the upper left corner).



Any propositions using tikz to add a part of a sphere would be greatly appreciated. Thank you.










share|improve this question









New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 1 hour ago


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 5





    welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

    – Zarko
    8 hours ago














0












0








0








I am trying to replace the black plan with a segment of a sphere using tikz :



continuation pseudo arclength



The sphere would be of centre H(Yi) and radius ||H(Yi) , H(Yi+1_0)|| on which will lie all the points from k=0 (green point) to k (blue point) (=> corresponding to an arc of a circle in the plan designated by the axis system in the upper left corner).



Any propositions using tikz to add a part of a sphere would be greatly appreciated. Thank you.










share|improve this question









New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












I am trying to replace the black plan with a segment of a sphere using tikz :



continuation pseudo arclength



The sphere would be of centre H(Yi) and radius ||H(Yi) , H(Yi+1_0)|| on which will lie all the points from k=0 (green point) to k (blue point) (=> corresponding to an arc of a circle in the plan designated by the axis system in the upper left corner).



Any propositions using tikz to add a part of a sphere would be greatly appreciated. Thank you.







tikz-pgf






share|improve this question









New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 7 hours ago







Yacola













New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 8 hours ago









YacolaYacola

63




63




New contributor




Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Yacola is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 1 hour ago


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 1 hour ago


Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 5





    welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

    – Zarko
    8 hours ago













  • 5





    welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

    – Zarko
    8 hours ago








5




5





welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

– Zarko
8 hours ago






welcome to tex.se! to my opinion your question (as is) is to broad and type do-it-for-me, so it will probably will be closed .... please show us, what you try so far.

– Zarko
8 hours ago











1 Answer
1






active

oldest

votes


















5














The purpose of this post is to define a style that draws a part of a sphere. More specifically, it will draw a segment in which the latitude and longitude are in a certain range. Drawing this segment is then as simple as saying



draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4];


where phi and theta are the longitude and latitude parameters.



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style args=%
phi from #1 to #2 and theta from #3 to #4 and radius #5insert path=%
plot[variable=x,smooth,domain=#2:#1]
(xyz spherical cs:radius=#5,longitude=x,latitude=#3)
-- plot[variable=x,smooth,domain=#3:#4]
(xyz spherical cs:radius=#5,longitude=#1,latitude=x)
--plot[variable=x,smooth,domain=#1:#2]
(xyz spherical cs:radius=#5,longitude=x,latitude=#4)
-- plot[variable=x,smooth,domain=#4:#3]
(xyz spherical cs:radius=#5,longitude=#2,latitude=x),
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument


enter image description here



Or a version for Henri Menke, who suggested the syntax



draw[thin,fill=white,fill opacity=0.6,sphere segment=r=4,r=4, phi=60:120, theta=-10:50];


Most likely I reinvented some things...



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
tikzset3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args=#1:#2defxmin#1defxmax#2,
sphere segment/.is family,
sphere segment/.cd,
r/.initial=1,
phi/.initial=0:30,
theta/.initial=0:30

begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style=
/utils/exec=tikzset3d stuff/sphere segment/.cd,#1%
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/phi
edefphiminxmin
edefphimaxxmax
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/theta
edefthetaminxmin
edefthetamaxxmax,
insert path=%
plot[variable=x,smooth,domain=phimax:phimin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamin)
-- plot[variable=x,smooth,domain=thetamin:thetamax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimin,latitude=x)
--plot[variable=x,smooth,domain=phimin:phimax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamax)
-- plot[variable=x,smooth,domain=thetamax:thetamin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimax,latitude=x) --cycle,
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=r=4,r=4, phi=60:120, theta=-10:50] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument





share|improve this answer

























  • Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

    – Yacola
    7 hours ago











  • @Yacola No worries and glad to hear that this goes in the right direction.

    – marmot
    7 hours ago











  • A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

    – Henri Menke
    5 hours ago











  • @HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

    – marmot
    3 hours ago

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









5














The purpose of this post is to define a style that draws a part of a sphere. More specifically, it will draw a segment in which the latitude and longitude are in a certain range. Drawing this segment is then as simple as saying



draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4];


where phi and theta are the longitude and latitude parameters.



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style args=%
phi from #1 to #2 and theta from #3 to #4 and radius #5insert path=%
plot[variable=x,smooth,domain=#2:#1]
(xyz spherical cs:radius=#5,longitude=x,latitude=#3)
-- plot[variable=x,smooth,domain=#3:#4]
(xyz spherical cs:radius=#5,longitude=#1,latitude=x)
--plot[variable=x,smooth,domain=#1:#2]
(xyz spherical cs:radius=#5,longitude=x,latitude=#4)
-- plot[variable=x,smooth,domain=#4:#3]
(xyz spherical cs:radius=#5,longitude=#2,latitude=x),
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument


enter image description here



Or a version for Henri Menke, who suggested the syntax



draw[thin,fill=white,fill opacity=0.6,sphere segment=r=4,r=4, phi=60:120, theta=-10:50];


Most likely I reinvented some things...



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
tikzset3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args=#1:#2defxmin#1defxmax#2,
sphere segment/.is family,
sphere segment/.cd,
r/.initial=1,
phi/.initial=0:30,
theta/.initial=0:30

begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style=
/utils/exec=tikzset3d stuff/sphere segment/.cd,#1%
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/phi
edefphiminxmin
edefphimaxxmax
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/theta
edefthetaminxmin
edefthetamaxxmax,
insert path=%
plot[variable=x,smooth,domain=phimax:phimin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamin)
-- plot[variable=x,smooth,domain=thetamin:thetamax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimin,latitude=x)
--plot[variable=x,smooth,domain=phimin:phimax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamax)
-- plot[variable=x,smooth,domain=thetamax:thetamin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimax,latitude=x) --cycle,
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=r=4,r=4, phi=60:120, theta=-10:50] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument





share|improve this answer

























  • Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

    – Yacola
    7 hours ago











  • @Yacola No worries and glad to hear that this goes in the right direction.

    – marmot
    7 hours ago











  • A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

    – Henri Menke
    5 hours ago











  • @HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

    – marmot
    3 hours ago















5














The purpose of this post is to define a style that draws a part of a sphere. More specifically, it will draw a segment in which the latitude and longitude are in a certain range. Drawing this segment is then as simple as saying



draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4];


where phi and theta are the longitude and latitude parameters.



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style args=%
phi from #1 to #2 and theta from #3 to #4 and radius #5insert path=%
plot[variable=x,smooth,domain=#2:#1]
(xyz spherical cs:radius=#5,longitude=x,latitude=#3)
-- plot[variable=x,smooth,domain=#3:#4]
(xyz spherical cs:radius=#5,longitude=#1,latitude=x)
--plot[variable=x,smooth,domain=#1:#2]
(xyz spherical cs:radius=#5,longitude=x,latitude=#4)
-- plot[variable=x,smooth,domain=#4:#3]
(xyz spherical cs:radius=#5,longitude=#2,latitude=x),
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument


enter image description here



Or a version for Henri Menke, who suggested the syntax



draw[thin,fill=white,fill opacity=0.6,sphere segment=r=4,r=4, phi=60:120, theta=-10:50];


Most likely I reinvented some things...



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
tikzset3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args=#1:#2defxmin#1defxmax#2,
sphere segment/.is family,
sphere segment/.cd,
r/.initial=1,
phi/.initial=0:30,
theta/.initial=0:30

begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style=
/utils/exec=tikzset3d stuff/sphere segment/.cd,#1%
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/phi
edefphiminxmin
edefphimaxxmax
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/theta
edefthetaminxmin
edefthetamaxxmax,
insert path=%
plot[variable=x,smooth,domain=phimax:phimin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamin)
-- plot[variable=x,smooth,domain=thetamin:thetamax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimin,latitude=x)
--plot[variable=x,smooth,domain=phimin:phimax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamax)
-- plot[variable=x,smooth,domain=thetamax:thetamin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimax,latitude=x) --cycle,
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=r=4,r=4, phi=60:120, theta=-10:50] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument





share|improve this answer

























  • Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

    – Yacola
    7 hours ago











  • @Yacola No worries and glad to hear that this goes in the right direction.

    – marmot
    7 hours ago











  • A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

    – Henri Menke
    5 hours ago











  • @HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

    – marmot
    3 hours ago













5












5








5







The purpose of this post is to define a style that draws a part of a sphere. More specifically, it will draw a segment in which the latitude and longitude are in a certain range. Drawing this segment is then as simple as saying



draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4];


where phi and theta are the longitude and latitude parameters.



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style args=%
phi from #1 to #2 and theta from #3 to #4 and radius #5insert path=%
plot[variable=x,smooth,domain=#2:#1]
(xyz spherical cs:radius=#5,longitude=x,latitude=#3)
-- plot[variable=x,smooth,domain=#3:#4]
(xyz spherical cs:radius=#5,longitude=#1,latitude=x)
--plot[variable=x,smooth,domain=#1:#2]
(xyz spherical cs:radius=#5,longitude=x,latitude=#4)
-- plot[variable=x,smooth,domain=#4:#3]
(xyz spherical cs:radius=#5,longitude=#2,latitude=x),
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument


enter image description here



Or a version for Henri Menke, who suggested the syntax



draw[thin,fill=white,fill opacity=0.6,sphere segment=r=4,r=4, phi=60:120, theta=-10:50];


Most likely I reinvented some things...



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
tikzset3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args=#1:#2defxmin#1defxmax#2,
sphere segment/.is family,
sphere segment/.cd,
r/.initial=1,
phi/.initial=0:30,
theta/.initial=0:30

begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style=
/utils/exec=tikzset3d stuff/sphere segment/.cd,#1%
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/phi
edefphiminxmin
edefphimaxxmax
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/theta
edefthetaminxmin
edefthetamaxxmax,
insert path=%
plot[variable=x,smooth,domain=phimax:phimin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamin)
-- plot[variable=x,smooth,domain=thetamin:thetamax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimin,latitude=x)
--plot[variable=x,smooth,domain=phimin:phimax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamax)
-- plot[variable=x,smooth,domain=thetamax:thetamin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimax,latitude=x) --cycle,
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=r=4,r=4, phi=60:120, theta=-10:50] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument





share|improve this answer















The purpose of this post is to define a style that draws a part of a sphere. More specifically, it will draw a segment in which the latitude and longitude are in a certain range. Drawing this segment is then as simple as saying



draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4];


where phi and theta are the longitude and latitude parameters.



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style args=%
phi from #1 to #2 and theta from #3 to #4 and radius #5insert path=%
plot[variable=x,smooth,domain=#2:#1]
(xyz spherical cs:radius=#5,longitude=x,latitude=#3)
-- plot[variable=x,smooth,domain=#3:#4]
(xyz spherical cs:radius=#5,longitude=#1,latitude=x)
--plot[variable=x,smooth,domain=#1:#2]
(xyz spherical cs:radius=#5,longitude=x,latitude=#4)
-- plot[variable=x,smooth,domain=#4:#3]
(xyz spherical cs:radius=#5,longitude=#2,latitude=x),
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=phi from 60 to 120 and theta from -10 to 50 and radius 4] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument


enter image description here



Or a version for Henri Menke, who suggested the syntax



draw[thin,fill=white,fill opacity=0.6,sphere segment=r=4,r=4, phi=60:120, theta=-10:50];


Most likely I reinvented some things...



documentclass[tikz,border=3.14mm]standalone 
usepackagetikz-3dplot
usetikzlibrary3d
tikzset3d stuff/.is family,
3d stuff/.cd,
parse domain/.code args=#1:#2defxmin#1defxmax#2,
sphere segment/.is family,
sphere segment/.cd,
r/.initial=1,
phi/.initial=0:30,
theta/.initial=0:30

begindocument
tdplotsetmaincoords7030
begintikzpicture[tdplot_main_coords,bullet/.style=fill,circle,inner
sep=1pt,sphere segment/.style=
/utils/exec=tikzset3d stuff/sphere segment/.cd,#1%
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/phi
edefphiminxmin
edefphimaxxmax
pgfkeys/tikz/3d stuff/parse domain/.expanded=pgfkeysvalueof/tikz/3d stuff/sphere segment/theta
edefthetaminxmin
edefthetamaxxmax,
insert path=%
plot[variable=x,smooth,domain=phimax:phimin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamin)
-- plot[variable=x,smooth,domain=thetamin:thetamax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimin,latitude=x)
--plot[variable=x,smooth,domain=phimin:phimax]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=x,latitude=thetamax)
-- plot[variable=x,smooth,domain=thetamax:thetamin]
(xyz spherical cs:radius=pgfkeysvalueof/tikz/3d stuff/sphere segment/r,
longitude=phimax,latitude=x) --cycle,
>=stealth,declare function=f(x)=exp(-2+0.5*x);]
draw[thick] (0,0,0) -- (4,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=0:4] (x,0,f(x));
% note: this domain is an approximation, it should really be
% from 0 to xmax where xmax is the solution of x^2+f(x)^2=4^2
draw[thin,fill=white,fill opacity=0.6,
sphere segment=r=4,r=4, phi=60:120, theta=-10:50] ;
draw[thick,->] (4,0,0) -- (6,0,0);
draw[thick,orange] plot[variable=x,smooth,domain=4:6] (x,0,f(x));
% should be xmax:6
endtikzpicture
enddocument






share|improve this answer














share|improve this answer



share|improve this answer








edited 1 hour ago

























answered 8 hours ago









marmotmarmot

113k5145274




113k5145274












  • Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

    – Yacola
    7 hours ago











  • @Yacola No worries and glad to hear that this goes in the right direction.

    – marmot
    7 hours ago











  • A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

    – Henri Menke
    5 hours ago











  • @HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

    – marmot
    3 hours ago

















  • Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

    – Yacola
    7 hours ago











  • @Yacola No worries and glad to hear that this goes in the right direction.

    – marmot
    7 hours ago











  • A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

    – Henri Menke
    5 hours ago











  • @HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

    – marmot
    3 hours ago
















Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

– Yacola
7 hours ago





Thanks for your answer @marmot, I should have just ask it with MWE in the first time, that wasn't intended to be the whole picture but more like what you just did, my bad...

– Yacola
7 hours ago













@Yacola No worries and glad to hear that this goes in the right direction.

– marmot
7 hours ago





@Yacola No worries and glad to hear that this goes in the right direction.

– marmot
7 hours ago













A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

– Henri Menke
5 hours ago





A nicer syntax would be sphere segment=r=4, phi=60:120, theta=-10:50 in my opinion.

– Henri Menke
5 hours ago













@HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

– marmot
3 hours ago





@HenriMenke Done. Note that one does not only need the domain but also explicitly the lower and upper ends (otherwise, yes, I would just have inserted the pgfkeys...).

– marmot
3 hours ago



Popular posts from this blog

Styletc

Tórshavn Kliima | Partnerstääden | Luke uk diar | Nawigatsjuun62° 1′ N, 6° 46′ W62° 1′ 0″ N, 6° 46′ 0″ WWMOTórshavn