Anonymous 1123
Let be four point
```0,0,a) coordinate (A')
(a,0,0) coordinate (B)
(0,a,0) coordinate (D)
(a,a,a) coordinate (C')
```
I am trying to draw a cone with vertex at `A'` and circle of base is `BDC`. I tried
```
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
\begin{tikzpicture}[3d/install view={phi=70,theta=65,psi=20},
line cap=round,line join=round,
declare function={a=4;}]
\path (0,0,a) coordinate (A')
(a,0,0) coordinate (B)
(0,a,0) coordinate (D)
(a,a,a) coordinate (C');
\path[3d/circumcircle center={A={(D)},B={(B)},C={(C')}}] coordinate (G);
\pgfmathsetmacro{\R}{sqrt(TD("(G)-(B)o(G)-(B)"))} ;
\pgfmathsetmacro{\h}{sqrt(TD("(G)-(A')o(G)-(A')"))} ;
\path[overlay,3d coordinate={(n)=(B)-(C')x(B)-(D)}];
\pic{3d/circle on sphere={R=\R,C={(G)},P={(G)},n={(n)}}};
%\path (a,2*a/3,a/3) coordinate (T) pic{3d/cone={r=\R,h/.evaluated=\h}};
\foreach \p in {A',B,C',D,G}
{\draw[fill=black] (\p) circle (1.2 pt);}
\foreach \p/\g in {G/-90,A'/-90,B/-90,C'/-90,D/90}
{\path (\p)+(\g:3mm) node{$\p$};}
\end{tikzpicture}
\end{document}
```

How can I draw the cone? And can I put the cone inot a cube like this?

Top Answer
marmot
I can currently only answer the first part of the question. It is as simple as finding an appropriate coordinate system, in which the z-axis points into the direction of axis of the cone.
```
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
\foreach \Angle in {5,15,...,355}
{\begin{tikzpicture}[3d/install view={phi=\Angle,theta=65,psi=20},
line cap=round,line join=round,same bounding box=A,
declare function={a=4;}]
\path (0,0,a) coordinate (A')
(a,0,0) coordinate (B)
(0,a,0) coordinate (D)
(a,a,a) coordinate (C');
\path[3d/circumcircle center={A={(D)},B={(B)},C={(C')}}] coordinate (G);
\pgfmathsetmacro{\R}{sqrt(TD("(G)-(B)o(G)-(B)"))}
\pgfmathsetmacro{\h}{sqrt(TD("(G)-(A')o(G)-(A')"))}
\tikzset{3d/define orthonormal dreibein={A={(D)},B={(B)},C={(C')}}}
\path[x={(ex)},y={(ey)},z={(ez)}]
(G) pic{3d/cone={r=\R,h=\h}};
\foreach \p/\g in {G/-90,A'/-90,B/-90,C'/-90,D/90}
{\draw[fill=black] (\p) circle[radius=1.2pt]+(\g:3mm) node{$\p$};}
\end{tikzpicture}}
\end{document}
```

The second part is much harder. One would have to compute a number of intersections. It would be even harder to make this fully rotatable.