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?
Is it ever safe to open a suspicious HTML file (e.g. email attachment)?
How to edit “Name” property in GCI output?
What flight has the highest ratio of timezone difference to flight time?
If Nick Fury and Coulson already knew about aliens (Kree and Skrull) why did they wait until Thor's appearance to start making weapons?
Is a distribution that is normal, but highly skewed considered Gaussian?
Why does standard notation not preserve intervals (visually)
Poetry, calligrams and TikZ/PStricks challenge
The past simple of "gaslight" – "gaslighted" or "gaslit"?
Bartok - Syncopation (1): Meaning of notes in between Grand Staff
Is it okay to majorly distort historical facts while writing a fiction story?
Is micro rebar a better way to reinforce concrete than rebar?
Is French Guiana a (hard) EU border?
Why didn't Khan get resurrected in the Genesis Explosion?
Chain wire methods together in Lightning Web Components
Does increasing your ability score affect your main stat?
Why doesn't UK go for the same deal Japan has with EU to resolve Brexit?
Newlines in BSD sed vs gsed
Make solar eclipses exceedingly rare, but still have new moons
Are police here, aren't itthey?
What was the first Unix version to run on a microcomputer?
Method for adding error messages to a dictionary given a key
WOW air has ceased operation, can I get my tickets refunded?
Is it my responsibility to learn a new technology in my own time my employer wants to implement?
Which one is the true statement?
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?
I am trying to replace the black plan with a segment of a sphere using tikz :
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
New contributor
put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 14 mins 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.
add a comment |
I am trying to replace the black plan with a segment of a sphere using tikz :
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
New contributor
put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 14 mins 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
6 hours ago
add a comment |
I am trying to replace the black plan with a segment of a sphere using tikz :
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
New contributor
I am trying to replace the black plan with a segment of a sphere using tikz :
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
tikz-pgf
New contributor
New contributor
edited 5 hours ago
Yacola
New contributor
asked 6 hours ago
YacolaYacola
63
63
New contributor
New contributor
put on hold as too broad by Stefan Pinnow, Sebastiano, Kurt, Henri Menke, JouleV 14 mins 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 14 mins 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
6 hours ago
add a comment |
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
6 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
6 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
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
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
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
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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would besphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.
– Henri Menke
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
1 hour ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
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
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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would besphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.
– Henri Menke
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
1 hour ago
add a comment |
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
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
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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would besphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.
– Henri Menke
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
1 hour ago
add a comment |
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
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
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
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
edited 14 mins ago
answered 6 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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would besphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.
– Henri Menke
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
1 hour ago
add a comment |
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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would besphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.
– Henri Menke
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
1 hour 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
6 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
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
@Yacola No worries and glad to hear that this goes in the right direction.
– marmot
6 hours ago
A nicer syntax would be
sphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.– Henri Menke
3 hours ago
A nicer syntax would be
sphere segment=r=4, phi=60:120, theta=-10:50
in my opinion.– Henri Menke
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
1 hour 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
1 hour ago
add a comment |
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
6 hours ago