I recently discovered the angles
TikZ library which is very convenient when one needs to annotate angles.
I encountered a problem when I tried to use it in with the 3d
library, since the arc is drawn without using the defined canvas plane. Here is an illustration (the alpha angle should be plotted as the green arc):
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{angles,quotes,3d}
\begin{document}
\begin{tikzpicture}
\draw[blue,->] (0,0)coordinate(O) -- (1,0,0)node[below right]{$\vec{x}$};
\draw[blue,->] (O) -- (0,1)node[above]{$\vec{y}$};
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C);
\draw[red] pic ["$\alpha$", draw, ->] {angle};
\end{tikzpicture}
\def\w{40} \def\aa{30}
\begin{tikzpicture}[x={({cos(\w)*1cm},{-sin(\w)*sin(\aa)*1cm})},
y={({sin(\w)*1cm},{cos(\w)*sin(\aa)*1cm})},
z={(0,{cos(\aa)*1cm})}]
\draw[blue,->] (0,0,0)coordinate(O) -- (1,0,0)node[below right]{$\vec{x}$};
\draw[blue,->] (O) -- (0,1,0)node[above]{$\vec{y}$};
\draw[blue,->] (O) -- (0,0,1)node[above]{$\vec{z}$};
\begin{scope}[canvas is xy plane at z=0]
\draw[dashed] (0,0) circle (1);
\draw (2,0) coordinate (A) -- (0,0) coordinate (B) -- (1,1) coordinate (C);
\draw[red] pic ["$\alpha$", draw, ->] {angle}; % incorrect
\draw[green] (0:0.6) arc (0:45:0.6); % correct
\end{scope}
\end{tikzpicture}
\end{document}
Is there a simple hack to have it work correctly?
Note that there is no problem with the right angle
command, since the plot consist in parallel segments.
tikz-3dplot
for angles in three dimensions.transform shape
is sufficient. Internallytikz-3dplot
also does nothing but drawing arcs. You only have to make sure theangle
pic
knows which coordinate system to use.