1

I am trying to define a cone in a 3D environment as a function of the center of its base C(x,y,z), its radius R and the top of the cone T(x,y,z).

The idea would be to able to precisely position the cone in a 3D space (axis environment)

Has anyone got some tips ?

1 Answers1

3

You can use 3dtools at here

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{calc,3dtools}% https://github.com/marmotghost/tikz-3dtools
\begin{document}
\begin{tikzpicture}[3d/install view={phi=70,theta=70},scale=1,line cap=butt,line join=round,c/.style={circle,fill,inner sep=1pt},
    declare function={r=3;h=3;}] 
        \path 
        (0,0,0) coordinate (C)
        (0,0,h) coordinate (T);
    \pic{3d/cone={r=r,h=h}};
    \path foreach \p/\g in {C/-90,T/90}
    {(\p)node[c]{}+(\g:2.5mm) node{$\p$}};
    \draw[3d/hidden] (T) -- (C);
\end{tikzpicture}
\end{document}  

enter image description here