TeX - LaTeX Asked by Guilherme Vargas on December 19, 2020

I’m looking for a simple way to draw (ideally using `TikZ`

) a cone with a plane through it to show my students where the ellipse comes from. It’s my very first year as a high school teacher and since teaching from home is the norm this year, I want to make nice images to use in the materials, rather than just writing equations and telling them where these things come from.

I have read:

Draw the four conic sections

Also:

How to draw a simple cone with height and radius with TikZ?

To try to better understand and ellaborate an approach, but I’m stuck at the very begining. I’m finding that not only I can’t create the image, I’m not *understanding* the answers on those posts.

I’m using the `beamer`

class, but in the future I’ll want to be able to use these drawings on worksheets, too. I have also consulted other websites, which seemed to suggest using the `pst-solides3d`

package, but I also read I can’t use it on `pdflatex`

…

Here’s the code I have so far (made a rough-looking cone, and decided the points where the ellipse will appear on it).

```
usepackage{pgfplots}
%pgfplotsset{compat=1.3}
pgfkeys{/pgf/number format/.cd,use comma}
usepgfplotslibrary{fillbetween,statistics}
usepackage{tikz,tikz-3dplot} %Para fazer desenhos
usetikzlibrary{shapes.multipart,shapes.geometric,calc,angles,positioning,intersections,quotes,decorations,babel,patterns,fit,arrows.meta,backgrounds,shadings,matrix,through,trees,mindmap,3d}
```

That’s in my preamble. Now in a frame in `beamer`

, I have:

```
begin{tikzpicture}
%The Cone
draw [dashed] (-1,0) arc (170:10:1.01 and 0.4) -- (1,0);
draw (-1,0) -- (0,3) -- (1,0) arc(-10:-170:1.01 and 0.4) --cycle;
%The Ellipse's starting and end points
path (-1,0) -- (0,3) coordinate [near end] (A);
path (0,3) -- (1,0) coordinate [midway] (B);
end{tikzpicture}
```

And here’s an image of what I’m trying to do. It does not need to have colors (just the "wireframe" is decent enough to me, although I’d appreciate to add color just to the ellipse, for the sake of making it clear).

Is there a simpler way to achieve the desired result? If possible, please explain the procedures so I’m not just copying and pasting but learning, too 🙂

Thanks in advance!

This is not an answer to your question, but I want to advice it is time consuming to draw nice images using `TikZ`

, however there is a nice software for this purpose and it is `GeoGebra`

. It can draw more, nice and complicated and animated pictures just by a few clicks.

Anyway, If you want to draw using `TiKz`

, the common trick is that, first you should do some calculus for intersection ellipse equation (if it is not matter, choose arbitrary ellipse) and draw the shapes in three steps:

- First the below part of the cone then
- draw the plane with
`opacity=0.5`

and - finally draw above part of the cone.

for circle section it is easy to draw, but in other cases it is complicated.

**Simple Example:**

```
documentclass[border=10pt]{standalone}
usepackage{pgfplots}
pgfplotsset{width=7cm,compat=1.8}
begin{document}
begin{tikzpicture}
begin{axis}[view={20}{40},hide axis, domain=0:1,
y domain=-1:1, xmin=-1.5, xmax=1.5,
ymin=-1.5, ymax=1.5, zmin=0.0]%
addplot3[surf, domain=0:0.85, domain y=-1:1,
mesh/interior colormap=
{blueblack}{color=(black) color=(blue)},
colormap/blackwhite,
samples=20,
samples y=40,
z buffer=sort,]
({x*cos(deg((y+1)*pi))},{x*sin(deg((y+1)*pi))},{x});
addplot3 [surf,domain=-.5:1.2, domain y=-1.5:1,samples=2, samples y=2,opacity=0.5]({x},{y},{.85});
addplot3[surf, domain=0.85:1, domain y=-1:1,
mesh/interior colormap=
{blueblack}{color=(black) color=(blue)},
colormap/blackwhite,
samples=20,
samples y=40,
z buffer=sort,]
({x*cos(deg((y+1)*pi))},{x*sin(deg((y+1)*pi))},{x});
%
end{axis}
end{tikzpicture}
end{document}
```

**Output:**

Correct answer by user108724 on December 19, 2020

Get help from others!

Recent Questions

- How can I transform graph image into a tikzpicture LaTeX code?
- How Do I Get The Ifruit App Off Of Gta 5 / Grand Theft Auto 5
- Iv’e designed a space elevator using a series of lasers. do you know anybody i could submit the designs too that could manufacture the concept and put it to use
- Need help finding a book. Female OP protagonist, magic
- Why is the WWF pending games (“Your turn”) area replaced w/ a column of “Bonus & Reward”gift boxes?

Recent Answers

- Peter Machado on Why fry rice before boiling?
- haakon.io on Why fry rice before boiling?
- Joshua Engel on Why fry rice before boiling?
- Lex on Does Google Analytics track 404 page responses as valid page views?
- Jon Church on Why fry rice before boiling?

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP