Draw the four conic sections
I want to draw the four conic sections (circumference, ellipse, parabola, and hyperbola) as shown in the picture:
MWE:
documentclass{article}
usepackage{pst-plot}
usepackage{tikz}
begin{document}
begin{tikzpicture}[line cap=round,line join=round,x=1.0cm,y=1.0cm]
clip(-2.48,-2.52) rectangle (2.68,5.44);
draw [line width=1.pt] (0.,0.) ellipse (2.cm and 0.8cm);
draw [line width=1.pt] (2.,0.)-- (0.,5.);
draw [line width=1.pt] (0.,5.)-- (-2.,0.);
draw [rotate around={25.:(-0.2,2.3)}] (-0.2,2.3) ellipse (1.15cm and 0.4cm);
draw [line width=1.pt] (0.,3.4) ellipse (0.65cm and 0.2cm);
draw [line width=1.pt] (1.4,1.4) parabola (1.6,-0.5);
draw [line width=1.pt] (1.4,1.4) parabola (0.75,0.75);
end{tikzpicture}
end{document}
tikz-pgf tikz-3dplot draw tikz-3d
add a comment |
I want to draw the four conic sections (circumference, ellipse, parabola, and hyperbola) as shown in the picture:
MWE:
documentclass{article}
usepackage{pst-plot}
usepackage{tikz}
begin{document}
begin{tikzpicture}[line cap=round,line join=round,x=1.0cm,y=1.0cm]
clip(-2.48,-2.52) rectangle (2.68,5.44);
draw [line width=1.pt] (0.,0.) ellipse (2.cm and 0.8cm);
draw [line width=1.pt] (2.,0.)-- (0.,5.);
draw [line width=1.pt] (0.,5.)-- (-2.,0.);
draw [rotate around={25.:(-0.2,2.3)}] (-0.2,2.3) ellipse (1.15cm and 0.4cm);
draw [line width=1.pt] (0.,3.4) ellipse (0.65cm and 0.2cm);
draw [line width=1.pt] (1.4,1.4) parabola (1.6,-0.5);
draw [line width=1.pt] (1.4,1.4) parabola (0.75,0.75);
end{tikzpicture}
end{document}
tikz-pgf tikz-3dplot draw tikz-3d
2
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51
add a comment |
I want to draw the four conic sections (circumference, ellipse, parabola, and hyperbola) as shown in the picture:
MWE:
documentclass{article}
usepackage{pst-plot}
usepackage{tikz}
begin{document}
begin{tikzpicture}[line cap=round,line join=round,x=1.0cm,y=1.0cm]
clip(-2.48,-2.52) rectangle (2.68,5.44);
draw [line width=1.pt] (0.,0.) ellipse (2.cm and 0.8cm);
draw [line width=1.pt] (2.,0.)-- (0.,5.);
draw [line width=1.pt] (0.,5.)-- (-2.,0.);
draw [rotate around={25.:(-0.2,2.3)}] (-0.2,2.3) ellipse (1.15cm and 0.4cm);
draw [line width=1.pt] (0.,3.4) ellipse (0.65cm and 0.2cm);
draw [line width=1.pt] (1.4,1.4) parabola (1.6,-0.5);
draw [line width=1.pt] (1.4,1.4) parabola (0.75,0.75);
end{tikzpicture}
end{document}
tikz-pgf tikz-3dplot draw tikz-3d
I want to draw the four conic sections (circumference, ellipse, parabola, and hyperbola) as shown in the picture:
MWE:
documentclass{article}
usepackage{pst-plot}
usepackage{tikz}
begin{document}
begin{tikzpicture}[line cap=round,line join=round,x=1.0cm,y=1.0cm]
clip(-2.48,-2.52) rectangle (2.68,5.44);
draw [line width=1.pt] (0.,0.) ellipse (2.cm and 0.8cm);
draw [line width=1.pt] (2.,0.)-- (0.,5.);
draw [line width=1.pt] (0.,5.)-- (-2.,0.);
draw [rotate around={25.:(-0.2,2.3)}] (-0.2,2.3) ellipse (1.15cm and 0.4cm);
draw [line width=1.pt] (0.,3.4) ellipse (0.65cm and 0.2cm);
draw [line width=1.pt] (1.4,1.4) parabola (1.6,-0.5);
draw [line width=1.pt] (1.4,1.4) parabola (0.75,0.75);
end{tikzpicture}
end{document}
tikz-pgf tikz-3dplot draw tikz-3d
tikz-pgf tikz-3dplot draw tikz-3d
edited Jan 15 at 19:21
Stefan Pinnow
19.7k83275
19.7k83275
asked Oct 30 '18 at 3:50
Samuel DiazSamuel Diaz
30628
30628
2
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51
add a comment |
2
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51
2
2
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51
add a comment |
1 Answer
1
active
oldest
votes
Here is a proposal. The function radius
is taken from here, which might also be the source of your picture. However, the upper bounds of the last two plots, i.e. values like 69.6
, are found by trial and error.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3d,backgrounds,intersections}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
begin{document}
tdplotsetmaincoords{70}{0}
begin{tikzpicture}[declare function={radius(x,y,z)=z/(1+y*cos(x));
h(x)=2.5*(2-x);},scale=2,set scale/.code={xdefmsc{#1}}]
begin{scope}[tdplot_main_coords]
begin{scope}[canvas is xy plane at z=0]
path[fill=orange!30] (0,0) circle (2);
coordinate (l) at (10:2);
coordinate (r) at (170:2);
draw[dashed,name path=back] (l) arc(10:170:2);
draw[thick,name path=front] (r) arc(170:370:2);
end{scope}
begin{scope}[on background layer]
draw[fill=orange!10] (l) -- (0,0,5) -- (r);
end{scope}
path[name path global=coat] (l) -- (0,0,5) -- (r);
pgfmathsetmacro{meps}{0}
%pgfmathsetmacro{msc}{0.75}
path[fill=blue] plot[variable=x,domain=-180:180,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
%pgfmathsetmacro{msc}{0.76}
fill[blue!60] plot[variable=x,domain=170:370,samples=72,set scale=0.76]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
--
plot[variable=x,domain=370:170,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle ;
pgfmathsetmacro{meps}{0.15}
path[fill=green!30!black] plot[variable=x,domain=-180:180,samples=72,set
scale=1.25]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
fill[green!70!black] plot[variable=x,domain=170:370,samples=72,set
scale=1.265] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=370:170,samples=72,set
scale=1.25] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
pgfmathsetmacro{meps}{1.5}
path[fill=red!80!black] plot[variable=x,domain=-70.6:70.6,samples=72,set
scale=3]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=red!80] plot[variable=x,domain=-70.6:10,samples=72,set
scale=3] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-69.6,samples=72,set
scale=3.05] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle;
pgfmathsetmacro{meps}{4}
path[fill=orange!80!black] plot[variable=x,domain=-51.4:51.4,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=orange!60] plot[variable=x,domain=-51.4:10,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-50,samples=72,set
scale=7.15]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))}) -- cycle;
end{scope}
end{tikzpicture}
end{document}
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457452%2fdraw-the-four-conic-sections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Here is a proposal. The function radius
is taken from here, which might also be the source of your picture. However, the upper bounds of the last two plots, i.e. values like 69.6
, are found by trial and error.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3d,backgrounds,intersections}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
begin{document}
tdplotsetmaincoords{70}{0}
begin{tikzpicture}[declare function={radius(x,y,z)=z/(1+y*cos(x));
h(x)=2.5*(2-x);},scale=2,set scale/.code={xdefmsc{#1}}]
begin{scope}[tdplot_main_coords]
begin{scope}[canvas is xy plane at z=0]
path[fill=orange!30] (0,0) circle (2);
coordinate (l) at (10:2);
coordinate (r) at (170:2);
draw[dashed,name path=back] (l) arc(10:170:2);
draw[thick,name path=front] (r) arc(170:370:2);
end{scope}
begin{scope}[on background layer]
draw[fill=orange!10] (l) -- (0,0,5) -- (r);
end{scope}
path[name path global=coat] (l) -- (0,0,5) -- (r);
pgfmathsetmacro{meps}{0}
%pgfmathsetmacro{msc}{0.75}
path[fill=blue] plot[variable=x,domain=-180:180,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
%pgfmathsetmacro{msc}{0.76}
fill[blue!60] plot[variable=x,domain=170:370,samples=72,set scale=0.76]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
--
plot[variable=x,domain=370:170,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle ;
pgfmathsetmacro{meps}{0.15}
path[fill=green!30!black] plot[variable=x,domain=-180:180,samples=72,set
scale=1.25]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
fill[green!70!black] plot[variable=x,domain=170:370,samples=72,set
scale=1.265] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=370:170,samples=72,set
scale=1.25] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
pgfmathsetmacro{meps}{1.5}
path[fill=red!80!black] plot[variable=x,domain=-70.6:70.6,samples=72,set
scale=3]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=red!80] plot[variable=x,domain=-70.6:10,samples=72,set
scale=3] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-69.6,samples=72,set
scale=3.05] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle;
pgfmathsetmacro{meps}{4}
path[fill=orange!80!black] plot[variable=x,domain=-51.4:51.4,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=orange!60] plot[variable=x,domain=-51.4:10,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-50,samples=72,set
scale=7.15]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))}) -- cycle;
end{scope}
end{tikzpicture}
end{document}
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
add a comment |
Here is a proposal. The function radius
is taken from here, which might also be the source of your picture. However, the upper bounds of the last two plots, i.e. values like 69.6
, are found by trial and error.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3d,backgrounds,intersections}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
begin{document}
tdplotsetmaincoords{70}{0}
begin{tikzpicture}[declare function={radius(x,y,z)=z/(1+y*cos(x));
h(x)=2.5*(2-x);},scale=2,set scale/.code={xdefmsc{#1}}]
begin{scope}[tdplot_main_coords]
begin{scope}[canvas is xy plane at z=0]
path[fill=orange!30] (0,0) circle (2);
coordinate (l) at (10:2);
coordinate (r) at (170:2);
draw[dashed,name path=back] (l) arc(10:170:2);
draw[thick,name path=front] (r) arc(170:370:2);
end{scope}
begin{scope}[on background layer]
draw[fill=orange!10] (l) -- (0,0,5) -- (r);
end{scope}
path[name path global=coat] (l) -- (0,0,5) -- (r);
pgfmathsetmacro{meps}{0}
%pgfmathsetmacro{msc}{0.75}
path[fill=blue] plot[variable=x,domain=-180:180,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
%pgfmathsetmacro{msc}{0.76}
fill[blue!60] plot[variable=x,domain=170:370,samples=72,set scale=0.76]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
--
plot[variable=x,domain=370:170,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle ;
pgfmathsetmacro{meps}{0.15}
path[fill=green!30!black] plot[variable=x,domain=-180:180,samples=72,set
scale=1.25]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
fill[green!70!black] plot[variable=x,domain=170:370,samples=72,set
scale=1.265] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=370:170,samples=72,set
scale=1.25] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
pgfmathsetmacro{meps}{1.5}
path[fill=red!80!black] plot[variable=x,domain=-70.6:70.6,samples=72,set
scale=3]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=red!80] plot[variable=x,domain=-70.6:10,samples=72,set
scale=3] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-69.6,samples=72,set
scale=3.05] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle;
pgfmathsetmacro{meps}{4}
path[fill=orange!80!black] plot[variable=x,domain=-51.4:51.4,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=orange!60] plot[variable=x,domain=-51.4:10,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-50,samples=72,set
scale=7.15]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))}) -- cycle;
end{scope}
end{tikzpicture}
end{document}
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
add a comment |
Here is a proposal. The function radius
is taken from here, which might also be the source of your picture. However, the upper bounds of the last two plots, i.e. values like 69.6
, are found by trial and error.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3d,backgrounds,intersections}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
begin{document}
tdplotsetmaincoords{70}{0}
begin{tikzpicture}[declare function={radius(x,y,z)=z/(1+y*cos(x));
h(x)=2.5*(2-x);},scale=2,set scale/.code={xdefmsc{#1}}]
begin{scope}[tdplot_main_coords]
begin{scope}[canvas is xy plane at z=0]
path[fill=orange!30] (0,0) circle (2);
coordinate (l) at (10:2);
coordinate (r) at (170:2);
draw[dashed,name path=back] (l) arc(10:170:2);
draw[thick,name path=front] (r) arc(170:370:2);
end{scope}
begin{scope}[on background layer]
draw[fill=orange!10] (l) -- (0,0,5) -- (r);
end{scope}
path[name path global=coat] (l) -- (0,0,5) -- (r);
pgfmathsetmacro{meps}{0}
%pgfmathsetmacro{msc}{0.75}
path[fill=blue] plot[variable=x,domain=-180:180,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
%pgfmathsetmacro{msc}{0.76}
fill[blue!60] plot[variable=x,domain=170:370,samples=72,set scale=0.76]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
--
plot[variable=x,domain=370:170,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle ;
pgfmathsetmacro{meps}{0.15}
path[fill=green!30!black] plot[variable=x,domain=-180:180,samples=72,set
scale=1.25]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
fill[green!70!black] plot[variable=x,domain=170:370,samples=72,set
scale=1.265] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=370:170,samples=72,set
scale=1.25] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
pgfmathsetmacro{meps}{1.5}
path[fill=red!80!black] plot[variable=x,domain=-70.6:70.6,samples=72,set
scale=3]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=red!80] plot[variable=x,domain=-70.6:10,samples=72,set
scale=3] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-69.6,samples=72,set
scale=3.05] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle;
pgfmathsetmacro{meps}{4}
path[fill=orange!80!black] plot[variable=x,domain=-51.4:51.4,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=orange!60] plot[variable=x,domain=-51.4:10,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-50,samples=72,set
scale=7.15]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))}) -- cycle;
end{scope}
end{tikzpicture}
end{document}
Here is a proposal. The function radius
is taken from here, which might also be the source of your picture. However, the upper bounds of the last two plots, i.e. values like 69.6
, are found by trial and error.
documentclass[tikz,border=3.14mm]{standalone}
usepackage{tikz-3dplot}
usetikzlibrary{3d,backgrounds,intersections}
% small fix for canvas is xy plane at z % https://tex.stackexchange.com/a/48776/121799
makeatletter
tikzoption{canvas is xy plane at z}{%
deftikz@plane@origin{pgfpointxyz{0}{0}{#1}}%
deftikz@plane@x{pgfpointxyz{1}{0}{#1}}%
deftikz@plane@y{pgfpointxyz{0}{1}{#1}}%
tikz@canvas@is@plane}
makeatother
begin{document}
tdplotsetmaincoords{70}{0}
begin{tikzpicture}[declare function={radius(x,y,z)=z/(1+y*cos(x));
h(x)=2.5*(2-x);},scale=2,set scale/.code={xdefmsc{#1}}]
begin{scope}[tdplot_main_coords]
begin{scope}[canvas is xy plane at z=0]
path[fill=orange!30] (0,0) circle (2);
coordinate (l) at (10:2);
coordinate (r) at (170:2);
draw[dashed,name path=back] (l) arc(10:170:2);
draw[thick,name path=front] (r) arc(170:370:2);
end{scope}
begin{scope}[on background layer]
draw[fill=orange!10] (l) -- (0,0,5) -- (r);
end{scope}
path[name path global=coat] (l) -- (0,0,5) -- (r);
pgfmathsetmacro{meps}{0}
%pgfmathsetmacro{msc}{0.75}
path[fill=blue] plot[variable=x,domain=-180:180,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
%pgfmathsetmacro{msc}{0.76}
fill[blue!60] plot[variable=x,domain=170:370,samples=72,set scale=0.76]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
--
plot[variable=x,domain=370:170,samples=72,set scale=0.75]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle ;
pgfmathsetmacro{meps}{0.15}
path[fill=green!30!black] plot[variable=x,domain=-180:180,samples=72,set
scale=1.25]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
fill[green!70!black] plot[variable=x,domain=170:370,samples=72,set
scale=1.265] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=370:170,samples=72,set
scale=1.25] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
pgfmathsetmacro{meps}{1.5}
path[fill=red!80!black] plot[variable=x,domain=-70.6:70.6,samples=72,set
scale=3]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=red!80] plot[variable=x,domain=-70.6:10,samples=72,set
scale=3] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-69.6,samples=72,set
scale=3.05] ({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- cycle;
pgfmathsetmacro{meps}{4}
path[fill=orange!80!black] plot[variable=x,domain=-51.4:51.4,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))});
path[fill=orange!60] plot[variable=x,domain=-51.4:10,samples=72,set
scale=7]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))})
-- plot[variable=x,domain=10:-50,samples=72,set
scale=7.15]
({radius(x,meps,msc)*cos(x)},
{radius(x,meps,msc))*sin(x)},{h(radius(x,meps,msc))}) -- cycle;
end{scope}
end{tikzpicture}
end{document}
edited Oct 31 '18 at 0:37
answered Oct 30 '18 at 4:56
marmotmarmot
93.8k4109208
93.8k4109208
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
add a comment |
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
1
1
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
For the record: Jake's patch is now incorporated in v3.1 of TikZ.
– Stefan Pinnow
Jan 15 at 19:21
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f457452%2fdraw-the-four-conic-sections%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Welcome!! Please use English in this site. If you have problems to translate it, please contact me (I am Argentinian). Also, what hace you tried so far?
– manooooh
Oct 30 '18 at 3:51