# drawing a line in polar coordinates

I have a point in polar coordinates (110:2cm), but from here I want to draw a line straight down.

Doing (110:1cm) is a line towards the center along 110 degrees. Without taking 2*sin(110) and 2*cos(110) to find the explicit x and y location, is there a way to say draw a line down from that location?

-
Relative coordinates is probably the thing you want. Or how exactly is the “line straight down” specified? Does it have a certain lengths, does it have to end at a certain y value? –  Qrrbrbirlbel May 5 '13 at 18:51
@Qrrbrbirlbel in this instance there wasn't a certain y but how would it be done if that was the case? –  dustin May 5 '13 at 18:54
See my answer. If it fails (because of complicated coordinates (maybe mixed with the calc library)) one have to fall-back to the perpendicular cs. –  Qrrbrbirlbel May 5 '13 at 19:28
\filldraw (110:2) circle (1pt) -- +(-90:1) node [below]{end of the line}; with (-90:1) we use only polar coordinates –  Alain Matthes May 5 '13 at 20:45

## With PSTricks:

Option 1:

\documentclass[pstricks,border=12pt]{standalone}
\SpecialCoor
\begin{document}
\begin{pspicture}[showgrid](-2,-2)(2,2)
\qdisk(2;110){1pt}
\psline[origin={2;110}](0,-1)
\end{pspicture}
\end{document}


Option 2:

\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pstricks-add}% \psrline is defined in this package but its documentation is explained in pst-node documentation, weird?
\begin{document}
\begin{pspicture}[showgrid](-2,-2)(2,2)
\qdisk(2;110){1pt}
\psrline(2;110)(0,-1)
\end{pspicture}
\end{document}


## Without PSTricks:

\documentclass[tikz,border=12pt]{standalone}

\begin{document}
\begin{tikzpicture}
\draw (-2,-2) grid (2,2);
\fill (110:2) circle (1pt);
\draw (110:2) -- +(0,-1);
\end{tikzpicture}
\end{document}


Remarks for TikZ:

• \draw (110:2) -- +(0,-1); The current point is (110:2). It draws a line from point (110:2) to point (110:2)+(0,-1) (vector addition). The current point is still at (110:2).

• \draw (110:2) -- ++(0,-1); The current point is (110:2). It draws a line from point (110:2) to point (110:2)+(0,-1) (vector addition). The current point is moved to (110:2)+(0,-1).

• \draw (110:2) +(0,-1) -- +(0,1); The current point is (110:2). It draws a line from point (110:2)+(0,-1) to point (110:2)+(0,1). The current point is still at (110:2).

• \draw (110:2) ++(0,-1) -- +(0,1); The current point is (110:2)+(0,-1). It draws a line from point (110:2)+(0,-1) to point (110:2)+(0,-1)+(0,1). The current point is still at (110:2)+(0,-1).

• \draw (110:2) ++(0,-1) -- ++(0,1); The current point is (110:2)+(0,-1). It draws a line from point (110:2)+(0,-1) to point (110:2)+(0,-1)+(0,1). The current point is moved to (110:2)+(0,-1)+(0,1) (which is equal to (110:2)).

• \draw (110:2) ++(0,-1) (1,1) -- +(0,1); The current point is (110:2)+(0,-1). Without drawing anything, the current point is moved to (1,1). Next, it draws a line from the current point (1,1) to (1,1)+(0,1). The current point is still at (1,1).

• \draw (110:2) ++(0,-1) (1,1) -- ++(0,1); The current point is (110:2)+(0,-1). Without drawing anything, the current point is moved to (1,1). Next, it draws a line from the current point (1,1) to (1,1)+(0,1). The current point is moved to (1,1)+(0,1).

-
\filldraw (110:2) circle (1pt) -- +(0,-1); –  Alain Matthes May 5 '13 at 20:43
@AlainMatthes: The circle was added to the answer just for showing the point (110:2). It should be regarded as an auxiliary object so it was intentionally separated from the line construction syntax for the sake of clearness. –  I am who I say I am May 5 '13 at 20:46
+1 for the remarks. Thanks. –  Sigur May 5 '13 at 23:12

## Code

\documentclass[tikz,convert=false]{standalone}
\usetikzlibrary{backgrounds} % for the grid
\tikzset{every picture/.append style={gridded,nodes={above,at end, font=\tiny}}} % example settings

\tikzset{
to y/.style={
to path={-- (\tikztostart|-0,\tikztotarget) \tikztonodes}},
to x/.style={
to path={-- (\tikztostart-|\tikztotarget,0) \tikztonodes}},
to y*/.style={
to path={-- (\tikztostart|-\tikztotarget) \tikztonodes}},
to x*/.style={
to path={-- (\tikztostart-|\tikztotarget) \tikztonodes}}
}
\begin{document}
\begin{tikzpicture}[]
\node at (0,0) {$(0,0)$};
\draw (110:2) node {(110:2)} -- ++ (down:1) node[midway,right] {I'm 1cm long.}; % this line is 1cm long
% also possible is (-90:1) or (90:-1) or (0,-1) or …
\end{tikzpicture}

\begin{tikzpicture}
\node at (0,0) {$(0,0)$};
\draw (110:2) node {(110:2)} -- (110:2|-0,1) node[right] {Here is $y=1$}; % this line goes from (110:2cm) down where y = 1cm
\end{tikzpicture}

\begin{tikzpicture}
\node at (0,0) {$(0,0)$};
\draw (110:3) node {(110:3)} to[to y] node[below] {$y=1.5$} (1.5) to[to x] node[above] {$x=0$} (0);
\end{tikzpicture}
\end{document}


-