Draw a sphere with a handle with TikZ
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
I am trying to draw a sphere with a handle similar to the one I have attached below with the package TikZ. Unfortunately, while I know how to draw a sphere or a torus, I don't know how to put them together without making a mess. Any kind of help or suggestion is very welcome, thanks.
So, for instance a sphere would be generated by a simple code as the one below, how to attach to this picture handle is however beyond my capacity at the moment
documentclass[a4paper,11pt]article
usepackage[T1]fontenc % if needed
usepackage[english]babel
usepackagegraphicx
usepackagetikz
begindocument
begintikzpicture[baseline]
shade[ball color = gray!40, opacity = 0.4] (0,0) circle (2cm);
draw (0,0) circle (2cm);
draw[dashed] (-2,0) arc (180:0:2 and 0.2);
draw[dashed] (-2,0) arc (180:0:2 and -0.2);
endtikzpicture
enddocument
this code produces
tikz-pgf 3d
add a comment |Â
up vote
3
down vote
favorite
I am trying to draw a sphere with a handle similar to the one I have attached below with the package TikZ. Unfortunately, while I know how to draw a sphere or a torus, I don't know how to put them together without making a mess. Any kind of help or suggestion is very welcome, thanks.
So, for instance a sphere would be generated by a simple code as the one below, how to attach to this picture handle is however beyond my capacity at the moment
documentclass[a4paper,11pt]article
usepackage[T1]fontenc % if needed
usepackage[english]babel
usepackagegraphicx
usepackagetikz
begindocument
begintikzpicture[baseline]
shade[ball color = gray!40, opacity = 0.4] (0,0) circle (2cm);
draw (0,0) circle (2cm);
draw[dashed] (-2,0) arc (180:0:2 and 0.2);
draw[dashed] (-2,0) arc (180:0:2 and -0.2);
endtikzpicture
enddocument
this code produces
tikz-pgf 3d
2
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass...
and ending withenddocument
.
â albert
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am trying to draw a sphere with a handle similar to the one I have attached below with the package TikZ. Unfortunately, while I know how to draw a sphere or a torus, I don't know how to put them together without making a mess. Any kind of help or suggestion is very welcome, thanks.
So, for instance a sphere would be generated by a simple code as the one below, how to attach to this picture handle is however beyond my capacity at the moment
documentclass[a4paper,11pt]article
usepackage[T1]fontenc % if needed
usepackage[english]babel
usepackagegraphicx
usepackagetikz
begindocument
begintikzpicture[baseline]
shade[ball color = gray!40, opacity = 0.4] (0,0) circle (2cm);
draw (0,0) circle (2cm);
draw[dashed] (-2,0) arc (180:0:2 and 0.2);
draw[dashed] (-2,0) arc (180:0:2 and -0.2);
endtikzpicture
enddocument
this code produces
tikz-pgf 3d
I am trying to draw a sphere with a handle similar to the one I have attached below with the package TikZ. Unfortunately, while I know how to draw a sphere or a torus, I don't know how to put them together without making a mess. Any kind of help or suggestion is very welcome, thanks.
So, for instance a sphere would be generated by a simple code as the one below, how to attach to this picture handle is however beyond my capacity at the moment
documentclass[a4paper,11pt]article
usepackage[T1]fontenc % if needed
usepackage[english]babel
usepackagegraphicx
usepackagetikz
begindocument
begintikzpicture[baseline]
shade[ball color = gray!40, opacity = 0.4] (0,0) circle (2cm);
draw (0,0) circle (2cm);
draw[dashed] (-2,0) arc (180:0:2 and 0.2);
draw[dashed] (-2,0) arc (180:0:2 and -0.2);
endtikzpicture
enddocument
this code produces
tikz-pgf 3d
tikz-pgf 3d
edited 1 hour ago
asked 2 hours ago
Fra
1254
1254
2
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass...
and ending withenddocument
.
â albert
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago
add a comment |Â
2
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting withdocumentclass...
and ending withenddocument
.
â albert
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago
2
2
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass...
and ending with enddocument
.â albert
2 hours ago
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass...
and ending with enddocument
.â albert
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
This is a TikZ (and not asymptote) question. With TikZ one can certainly get some aspects of this right, but getting all of it right is arguably very hard. So this is a compromise.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords70110
begintikzpicture[tdplot_main_coords]
path[tdplot_screen_coords,use as bounding box] (-3.2,-3.2) rectangle (6,6);
pgfmathsetmacroR3
pgfmathsetmacromyang20
pgfmathsetmacroangtop-80
pgfmathsetmacroangright95
coordinate (O) at (0,0,0);
shadedraw [ball color=red,tdplot_screen_coords] (0,0,0) circle(R);
path
(3*sin(myang)*cos(angright),3*cos(myang),3*sin(myang)*sin(angright)) coordinate (P1)
(3*sin(myang)*cos(angtop),3*sin(myang)*sin(angtop),3*cos(myang)) coordinate (P2);
draw[right color=white,left color=red!80!black,shading angle=-225] plot[variable=x,domain=angtop:angtop+180,samples=91]
(3*sin(myang)*cos(x),3*sin(myang)*sin(x),3*cos(myang))
to[out=90,in=0,looseness=2] (P1)
plot[variable=x,domain=angright:angright-180,samples=91]
(3*sin(myang)*cos(x),3*cos(myang),3*sin(myang)*sin(x))
to[out=0,in=90,looseness=4] (P2);
endtikzpicture
enddocument
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
This is a TikZ (and not asymptote) question. With TikZ one can certainly get some aspects of this right, but getting all of it right is arguably very hard. So this is a compromise.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords70110
begintikzpicture[tdplot_main_coords]
path[tdplot_screen_coords,use as bounding box] (-3.2,-3.2) rectangle (6,6);
pgfmathsetmacroR3
pgfmathsetmacromyang20
pgfmathsetmacroangtop-80
pgfmathsetmacroangright95
coordinate (O) at (0,0,0);
shadedraw [ball color=red,tdplot_screen_coords] (0,0,0) circle(R);
path
(3*sin(myang)*cos(angright),3*cos(myang),3*sin(myang)*sin(angright)) coordinate (P1)
(3*sin(myang)*cos(angtop),3*sin(myang)*sin(angtop),3*cos(myang)) coordinate (P2);
draw[right color=white,left color=red!80!black,shading angle=-225] plot[variable=x,domain=angtop:angtop+180,samples=91]
(3*sin(myang)*cos(x),3*sin(myang)*sin(x),3*cos(myang))
to[out=90,in=0,looseness=2] (P1)
plot[variable=x,domain=angright:angright-180,samples=91]
(3*sin(myang)*cos(x),3*cos(myang),3*sin(myang)*sin(x))
to[out=0,in=90,looseness=4] (P2);
endtikzpicture
enddocument
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
add a comment |Â
up vote
3
down vote
accepted
This is a TikZ (and not asymptote) question. With TikZ one can certainly get some aspects of this right, but getting all of it right is arguably very hard. So this is a compromise.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords70110
begintikzpicture[tdplot_main_coords]
path[tdplot_screen_coords,use as bounding box] (-3.2,-3.2) rectangle (6,6);
pgfmathsetmacroR3
pgfmathsetmacromyang20
pgfmathsetmacroangtop-80
pgfmathsetmacroangright95
coordinate (O) at (0,0,0);
shadedraw [ball color=red,tdplot_screen_coords] (0,0,0) circle(R);
path
(3*sin(myang)*cos(angright),3*cos(myang),3*sin(myang)*sin(angright)) coordinate (P1)
(3*sin(myang)*cos(angtop),3*sin(myang)*sin(angtop),3*cos(myang)) coordinate (P2);
draw[right color=white,left color=red!80!black,shading angle=-225] plot[variable=x,domain=angtop:angtop+180,samples=91]
(3*sin(myang)*cos(x),3*sin(myang)*sin(x),3*cos(myang))
to[out=90,in=0,looseness=2] (P1)
plot[variable=x,domain=angright:angright-180,samples=91]
(3*sin(myang)*cos(x),3*cos(myang),3*sin(myang)*sin(x))
to[out=0,in=90,looseness=4] (P2);
endtikzpicture
enddocument
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
This is a TikZ (and not asymptote) question. With TikZ one can certainly get some aspects of this right, but getting all of it right is arguably very hard. So this is a compromise.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords70110
begintikzpicture[tdplot_main_coords]
path[tdplot_screen_coords,use as bounding box] (-3.2,-3.2) rectangle (6,6);
pgfmathsetmacroR3
pgfmathsetmacromyang20
pgfmathsetmacroangtop-80
pgfmathsetmacroangright95
coordinate (O) at (0,0,0);
shadedraw [ball color=red,tdplot_screen_coords] (0,0,0) circle(R);
path
(3*sin(myang)*cos(angright),3*cos(myang),3*sin(myang)*sin(angright)) coordinate (P1)
(3*sin(myang)*cos(angtop),3*sin(myang)*sin(angtop),3*cos(myang)) coordinate (P2);
draw[right color=white,left color=red!80!black,shading angle=-225] plot[variable=x,domain=angtop:angtop+180,samples=91]
(3*sin(myang)*cos(x),3*sin(myang)*sin(x),3*cos(myang))
to[out=90,in=0,looseness=2] (P1)
plot[variable=x,domain=angright:angright-180,samples=91]
(3*sin(myang)*cos(x),3*cos(myang),3*sin(myang)*sin(x))
to[out=0,in=90,looseness=4] (P2);
endtikzpicture
enddocument
This is a TikZ (and not asymptote) question. With TikZ one can certainly get some aspects of this right, but getting all of it right is arguably very hard. So this is a compromise.
documentclass[tikz,border=3.14mm]standalone
usepackagetikz-3dplot
begindocument
tdplotsetmaincoords70110
begintikzpicture[tdplot_main_coords]
path[tdplot_screen_coords,use as bounding box] (-3.2,-3.2) rectangle (6,6);
pgfmathsetmacroR3
pgfmathsetmacromyang20
pgfmathsetmacroangtop-80
pgfmathsetmacroangright95
coordinate (O) at (0,0,0);
shadedraw [ball color=red,tdplot_screen_coords] (0,0,0) circle(R);
path
(3*sin(myang)*cos(angright),3*cos(myang),3*sin(myang)*sin(angright)) coordinate (P1)
(3*sin(myang)*cos(angtop),3*sin(myang)*sin(angtop),3*cos(myang)) coordinate (P2);
draw[right color=white,left color=red!80!black,shading angle=-225] plot[variable=x,domain=angtop:angtop+180,samples=91]
(3*sin(myang)*cos(x),3*sin(myang)*sin(x),3*cos(myang))
to[out=90,in=0,looseness=2] (P1)
plot[variable=x,domain=angright:angright-180,samples=91]
(3*sin(myang)*cos(x),3*cos(myang),3*sin(myang)*sin(x))
to[out=0,in=90,looseness=4] (P2);
endtikzpicture
enddocument
answered 1 hour ago
marmot
71.5k476152
71.5k476152
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
add a comment |Â
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
this is an awesome solution, thanky you. Do you think there is a way to shrink the handle a little?
â Fra
20 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
@Fra When I'm back from cycling I'll give it a shot.... (give me a few hours, please)
â marmot
10 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458328%2fdraw-a-sphere-with-a-handle-with-tikz%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
2
Welcome to TeX.SX! Please help us help you and add a minimal working example (MWE) that illustrates your problem. Reproducing the problem and finding out what the issue is will be much easier when we see compilable code, starting with
documentclass...
and ending withenddocument
.â albert
2 hours ago
How spherical does the sphere have to be? You could draw a topologically equivalent picture fairly easily using the tqft package.
â Loop Space
2 hours ago
I, unfortunately , need it to be quite spherical or else I would have drawn a torus.
â Fra
2 hours ago
I have added the base code to generate a sphere, how to add a handle is not something I know how to do and is what I am asking about
â Fra
1 hour ago
It would be simpler is the torus intersected the sphere perpendicularly. You can use a pgfplots version of a torus with a reduced domain, Then all you have to do is place the center of the torus on the surface of the sphere.
â John Kormylo
1 hour ago