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.

5
  • 1
    spiral spring in tikz might be of interest here.
    – Jake
    Jun 18, 2012 at 17:28
  • Notice that the spiral here do not start at its center
    – leo
    Jun 18, 2012 at 17:33
  • 1
    Yes, it's not an exact duplicate. But the general approach works here too: Try \draw [domain=0:10,variable=\t,smooth,samples=75] plot ({\t r}: {0.05*\t+0.1});
    – Jake
    Jun 18, 2012 at 17:39
  • 2
    BTW, I believe that the -440 angle is incorrectly labelled, it should be 440 degrees (not minus). Jun 18, 2012 at 18:22
  • @PeterGrill you are absolutely right! thanks for point that
    – leo
    Jun 18, 2012 at 19:30

2 Answers 2

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

3
  • This is exactly what I want.
    – leo
    Jun 18, 2012 at 21:19
  • Incredible, good math skills to achieve the desired output.
    – azetina
    Jul 3, 2012 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 4, 2013 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}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .