# Draw lines by specifying angles?

I'd like to be able to draw lines in LaTeX by specifying an angle, rather than specifying it like so

\put(0,0){\line(2,1){3}}


Is this possible? I've looked at tikz and tikz-euclid. I've even tried installing tikz-euclid, but I couldn't even do that (I found these but couldn't find the .ins for tikz-euclid). And I'm not sure if that's what I want anyway.

What do I need to do to accomplish this?

-
Drawing a line by knowing a point and a slope: tex.stackexchange.com/a/6000/9467, drawing chained lines by knowing a point and slopes relative to the previous line: tex.stackexchange.com/a/7788/9467 –  Who is crazy first Feb 9 '12 at 0:36
They both cover PS (?) specifically, but I prefer the PGF answer below. –  Pureferret Feb 9 '12 at 0:39
OK. I also want to make a Linked as shown on the right. –  Who is crazy first Feb 9 '12 at 1:04

You can read about it in the pgf manual on p. 31, Section 2.5.

An example:

\documentclass{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
% Draw a line at 30 degrees and of length 3
\draw (0,0) -- (30:3cm);
\end{tikzpicture}
\end{document}


You can also use the relative coordinates:

\begin{tikzpicture}
% Draw something more
\draw (0,0) -- (30:3cm) -- ++(80:3cm);
\end{tikzpicture}

-
This is like some kind of special magic. Thank you so much. –  Pureferret Feb 8 '12 at 23:31
You're welcome, although I could not find, how to specify a relative angle to the previous line. If you find it, please post here. :) –  gns-ank Feb 8 '12 at 23:42
As a note, this only works when the line originates at the origin. So the example is correct if it starts at (0,0) but if you were to write \draw (-2,0) -- (30:3cm); the line has the wrong angle. It points toward the end point it would have if it started at the origin. –  Ian Durham Sep 29 '13 at 19:15
The point is that (30:3cm) defines a point in polar coordinates with respect to the origin. What want in this case is to use relative coordinates and to preceed the coordinate with ++. So, the command in your case is \draw (-2,0) -- ++(30:3cm); –  gns-ank Sep 30 '13 at 12:24

Here is a very minimal example showing how this can be done using pstricks:

\documentclass{article}
\usepackage{pstricks}% http://ctan.org/pkg/pstricks
\begin{document}
\begin{pspicture}(4,4)
\psgrid % For reference; shows a coordinate grid
\SpecialCoor % Allows for specifying polar coordinates (r;t)
\psline(0,0)(4;65)
\end{pspicture}
\end{document}​


\SpecialCoor adds a polar coordinate reference to the existing Cartesian (x,y)-coordinate specification. The difference is specified using (r;t) (r = length; t = angle) rather than (x,y). Measurements in the above MWE is in centimetres (default).

-