I am trying to use tikz-3dplot
to draw a cube and I was particularly interested by the possibility to define a point using \tdplotsetcoord
which allows to get x/y/z/xz... coordinates. But when I try to define a point in (4,4,4) of the main coordinate system of tikz-3dplot
(so \tdplotsetcoord{P}{sqrt(3)*4}{45}{45}
I think), I do not get what I am expecting as you can see below. The blue and black nodes should be the same in my figure. Any ideas ?
\documentclass[tikz]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords]
% cube
\tdplotsetcoord{P}{sqrt(3)*4}{45}{45}
\draw[dashed]
(0,0,0) -- (Px)
(0,0,0) -- (Py)
(0,0,0) -- (Pz);
\draw[->]
(Px) -- ++ (1,0,0) node[anchor=north east]{$x$};
\draw[->]
(Py) -- ++(0,1,0) node[anchor=north west]{$y$};
\draw[->]
(Pz) -- ++(0,0,1) node[anchor=south]{$z$};
\draw[thick]
(Pxz) -- (P) -- (Pxy) -- (Px) -- (Pxz) -- (Pz) -- (Pyz) -- (P);
\draw[thick]
(Pyz) -- (Py) -- (Pxy);
\filldraw[dashed,blue] (0,0,0)-- (P) circle (2pt);
\filldraw[dashed] (0,0,0)-- (4,4,4) circle (2pt);
\end{tikzpicture}
\end{document}
(r*cos(theta)*cos(phi),r*cos(theta)*sin(phi),r*sin(theta))=(4,4,4)
fortheta=phi=45
?