I am working with tikz.

I want to draw a line that is rectangular to a certain other line and has a certain length.

The coordinates are defined as cartesian.

What I am searching for is a function to derive the slope angle of the existing line so I can conveniently define the new line via polar coordinates

(or any other convenient solution).

Thank you in advance!

  • 2
    Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Commented Jan 22, 2022 at 8:48
  • 1
    Welcome to TeX.SE. It would be helpful if you composed a fully compilable MWE including \documentclass and the appropriate packages that sets up the problem as much as possible. That way those trying to help can focus on the solution as opposed to setting up the problem test case. Commented Jan 22, 2022 at 9:07

1 Answer 1


You can draw perpendicular lines to a previous one with calc library. There is no need for passing to polar coordinates.



\coordinate (a) at (0,0);
\coordinate (b) at (5,2);

\draw (a) -- coordinate[pos=.33] (c1) coordinate[pos=.7] (c2) (b);
\draw (c1) -- ($(c1)!15mm!90:(b)$); 
\draw (c2) -- ($(c2)!15mm!-90:(b)$); 


enter image description here

You must log in to answer this question.

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