I need to draw arcs to denote angles inside an equilateral triangle. To do this, I am using the arc function in tikz with the help of the calc package. However, if I use an automatic solution which computes the degrees of the difference vectors between the vertexes, I get an undesired result (the black arc in the following example code).
\begin{tikzpicture}[scale=8]
\coordinate (center) at (0, 0);
\coordinate (A) at (-0.5, 0);
\coordinate (B) at (0.5, 0);
\coordinate (C) at (0, {sqrt(3)/2});
\draw (A) -- (B) -- (C) -- cycle;
\coordinate (C1) at ($(C)!0.1!(A)$);
\coordinate (C2) at ($(C)!0.1!(B)$);
\draw
let \p1 = ($(C1) - (C)$),
\p2 = ($(C2) - (C)$),
\n0 = {veclen(\x1,\y1)},
\n1 = {atan2(\x1, \y1)},
\n2 = {atan2(\x2, \y2)}
in (C) arc(\n1:\n2:\n0);
\path
let \p1 = ($(C1) - (C)$),
\p2 = ($(C2) - (C)$),
\n0 = {veclen(\x1, \y1)},
\n1 = {atan2(\x1, \y1)},
\n2 = {atan2(\x2, \y2)}
in node at (C) {$\n1,\, \n2$};
\draw[red] (C1) arc(240:300:0.1);
\end{tikzpicture}
If I display the values of the initial an final angles, they appear in pt which converted are like +60° and -60°. These values are clearly wrong. Vice versa, if I set the correct angles manually, then the arc is fine. Nevertheless, I need to go through the "automatic" solution because I cannot manually compute the initial and final angles for more complex figures. Can anybody tell me how to fix this problem? Also, is there a way to display the initial and final angles in degrees rather than in points? Thank you very much!
\documentclass{...}
, the required\usepackage
's,\begin{document}
, and\end{document}
. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. In particular, you seem to have certain TikZ libraries missing.pt
s as far as I know. That gives a length-type dimension. You know there is anangle
library for drawing angles?