22

When teaching trigonometry, sometimes it is useful to represent angles greater than 360º with some kind of "spiral arc". For example:

angles

the angle of -440º in the figure.

My question is:

How can I do this in nicely TikZ?

I can do it by using several consecutive arcs, but I wish to know if is there a more elegant solution to this.

leo
  • 1,337

2 Answers2

27
 \documentclass[11pt]{scrartcl}
 \usepackage{tikz}
 \usetikzlibrary{arrows}

 \begin{document} 

 \newcommand\bigangle[2][]{% 
    \draw[->,domain=0:#2,variable=\t,samples=200,>=latex,#1]
      plot ({(\t+#2)*cos(\t)/(#2)},
           {(\t+#2)*sin(\t)/(#2)}) node[right=.5cm] {$#2^\circ$}
        ;}

 \begin{tikzpicture}
 \draw [thick] ( 0,0) -- (3,0);
 \draw [thick] ( 0,0) -- (0,3); 
 \draw [red,thick] ( 0,0) -- (400:3); 
 \bigangle[blue,dashed]{400}      
 \end{tikzpicture}
 \end{document}

enter image description here

enter image description here

Alain Matthes
  • 95,075
  • This is exactly what I want. – leo Jun 18 '12 at 21:19
  • Incredible, good math skills to achieve the desired output. – azetina Jul 03 '12 at 19:52
  • The command works great for angles grater than 360. But it looks weird when we pass an angle a with 0 < abs(a) < 360. So far I've managed to fix it by using a conditional construct via the ifthen package. Is it possible to fix this without using any extra package? – leo Sep 04 '13 at 16:04
14

Jake's method is probably simpler, but here I have adapted the standard parametric equation for a spiral and added an offset so that the spiral does not start at the origin to yield:

enter image description here

Notes:

  • The 440 in the denominator is to normalize the graph so that the arc ends at a y=1.
  • Polar equations should yield similar results with simpler equations.
  • There is something wrong with the brown line (even though it is in the correct spot) as it is not ending where I think it should, but this is not related to generating the spiral.

Code:

\documentclass{article}
\usepackage{pgfplots}

\newcommand{\Offset}{360}% \begin{document} \begin{tikzpicture} \begin{axis}[xmin=-2.5,xmax=2.5,ymin=-2.5,ymax=2.5, axis lines=center] \addplot[blue,densely dashed,domain=0:440,samples=200,-latex] ({(x+\Offset)cos(x+\Offset)/(440+\Offset)}, {(x+\Offset)*sin(x+\Offset)/(440+\Offset)});

% Show the 440 degree angle
\pgfmathsetmacro{\XValue}{1.0}%
\pgfmathsetmacro{\YValue}{\XValue*tan(440)}%
\draw [brown, thick] (axis cs: 0,0) -- (axis cs: \XValue,\YValue);

\end{axis} \end{tikzpicture} \end{document}

Peter Grill
  • 223,288