# draw two tangent cones in tikz

I would like to draw in tikz two cones tangent along a common generatrix, like in the picture below. I managed to draw the vertical cone (even taking into account that the two generatrices drawn should be tangent to the ellipse, so that their endpoints are not the endpoints of the major semi axis), but I'm not sure how to draw the inclined cone. Any help would be much appreciated. • Could you please add a minimum working example (your code, but stripped by everything irrelevant, such that anyone might copy it and immediately compile it)? – Concerto Dec 23 '20 at 23:33
• It should be easy to draw this with tikz-3dplot. – user231225 Dec 24 '20 at 0:03

## 1 Answer

Maybe this is a start. I just copied the critical angle from another post but this works only for the main coordinates. The top circles of the cones are correct, I think, and the cones are tangential.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz-3dplot}
\usetikzlibrary{intersections}
\begin{document}
\tdplotsetmaincoords{70}{20}
\begin{tikzpicture}[tdplot_main_coords,line join=round, line cap=round,
declare function={H=4;alpha=25;beta=15;
ha=H*cos(alpha);ra=H*sin(alpha);
hb=H*cos(beta);rb=H*sin(beta);}]
\draw (0,0,0) coordinate (O) -- (5,0,0) node[below]{$1$}
(O) -- (0,5,0) node[below]{$2$};
\path (O) -- (0,0,5) coordinate (z);
\begin{scope}[canvas is xy plane at z=ha]
% https://tex.stackexchange.com/a/540838
\pgfmathsetmacro{\alphacrit}{90-acos(ra*cos(\tdplotmaintheta)/ha)}%
\draw  (\tdplotmainphi-\alphacrit:ra) coordinate (c1) -- (O)
-- (180+\tdplotmainphi+\alphacrit:ra) coordinate (c2);
\draw (0,0) circle[radius=ra];
\end{scope}
\draw[dashed] (O) -- (0,0,{ha-ra*cos(\tdplotmaintheta)}) coordinate (i1);
\draw[thick,-stealth] (i1) -- (0,0,5) node[above right]{$\boldsymbol{L}$};
\tdplotsetrotatedcoords{\tdplotmainphi-180}{alpha+beta}{0}
\begin{scope}[tdplot_rotated_coords]
\draw[name path=z'] (O) -- (0,0,5) coordinate[label=above:{$3$}](z');
\begin{scope}[canvas is xy plane at z=hb]
% https://tex.stackexchange.com/a/540838
\pgfmathsetmacro{\alphacrit}{90-acos(rb*cos(\tdplotmaintheta)/hb)}%
\draw  (\tdplotmainphi-\alphacrit:rb) coordinate (c3) -- (O)
(90+\tdplotmainphi:rb) coordinate (i2);
\draw[name path=circb] (0,0) circle[radius=rb];
\draw[dashed,name intersections={of=circb and z',by=i2}] (O) -- (i2);
\end{scope}
\draw[-stealth] (i2) -- (0,0,4.5) node[left]{$\boldsymbol{L_3}$};
\end{scope}
\end{tikzpicture}
\end{document} • This is exactly what I needed! Thanks a lot. – user3476591 Dec 24 '20 at 11:33
• Just one more thing. Would it be hard to also shade the cones in some way (for example, light gray)? – user3476591 Dec 25 '20 at 12:35