Find Vector Perpendicular to Line


Maybe a bit of a strange question, but I cant Find it.

Tree A: containing straight lines

Question: I would like to retrieve the vectors which run ‘perpendicular’ to the lines.

Of course, It is simple to get the vectors which run along a line. (see image below).

But what I don’t understand is how to get ‘perpendicular’ vectors.
In which direction the vector is pointing is not relevant for me, as long as it is perpendicular to the lines. :slight_smile:

any suggestions?

2021-11-19 Find Vector perpendicular to (10.3 KB)

btw I found an formula which does the trick when the ‘original’ line is fully vertical. Unfortunately for all lines which are not vertical this does not work… :frowning:

Thanks again!


Perpendicular in which plane?

You can evaluate a curve at a given parameter or for a line in any direction create a perpendicular frame.

Thanks for your quick reply!

frankly the plane does not matter, as long as it is perpendicular. :sweat_smile:

I tried evaluate curve, unfortunately the line which is not vertical is not perpendicular.
Or how do you create an perpendicular frame?

Thanks Again! :slight_smile:

Eval doesn’t give you a vector but a point at the evaluated parameter on the curve.
I’d use PFrame (Perpendicular Frame), which works similar to Eval, but returns a plane that is perpendicular to the line. You can then deconstruct the plane and use its x- or y-axis vector as a perpendicular one. You could even rotate that vector in the same plane to vary it.

Draw a circle and all lines are perpendicular

2021-11-19 Find Vector perpendicular to (7.2 KB)


There is no such thing as a single perpendicular vector to a line. In other words, there is an infinite number of perpendicular vectors to a line. Hence we call it a perpendicular frame.

Ahh perfect, thanks! :+1: :+1:

I did know that there where an infinite number of planes possible, but I didn’t know how to get 1.

Thanks again, this does the trick perfectly!



Thanks again for your help. :slight_smile:

It did turn out I do have a ‘preference’ plane :see_no_evil:.

What I would like to get is the vector - perpendicular to the line - which runs in the ‘most vertical’ direction possible.

I tried to do this by retrieving the highest point of the circle, after which I can draw a line/vector. Unfortunately this ‘finding highest point’ is quite a slow component (example is only with 4 lines, but in the end it will be lots more…).
Besides this goes not correctly for horizontal lines.

Do you have an suggestion how you can draw a vector - perpendicular to the line - which runs in the most vertical direction possible?
Something like closest vector to vertical ?

2021-11-19 Find Vector perpendicular to (9.7 KB)

Thanks again! :slight_smile:

Just extrude the line vertically and intersect it with the circle, that should give you what you want.


Thanks for your quick reply :).
Unfortunately the cirkcle is not fully vertical so the extrusion will not ‘intersect’ with the curve?
Or maybe I am wrong
Would it be possible to use the GH file?

Thanks again!

You can align a perp frame with a Z axis vector using the align plane component. Then deconstruct the plane and I think it will be the X vector you’re looking for. Not at the computer, so can’t provide more right now.

here you go

vert perp line (7.8 KB)

Definitely a big step in the right direction:

The only thing is that the horizontal line (in the back) is 90 degree of… :frowning:
Any suggestion how I can overcome this. as the tool will be needed regardless of the original Line direction…

2021-11-19 Find Vector perpendicular to (10.7 KB)

Thanks again!

2021-11-19 Find Vector perpendicular to (11.7 KB)


Wow that looks perfect!
What does the amplitude function do? (And why 4,25 :sweat_smile:)
Not at my laptop anomore…


Thanks @HS_Kim

The amplitude is a factor to scale the vector length so it is easier to see.

1 Like

Ahh haha ofcourse :see_no_evil:.
I did not notice the different component ‘deconstruct plane’ instead of ‘deconstruct planeS

Thanks @martinsiegrist and @HS_Kim it works! :+1: :+1:

1 Like