# Find Vector Perpendicular to Line

Hi,

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.

any suggestions?

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…

Thanks again!

Thanks!

Perpendicular in which plane?

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

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

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

Thanks Again!

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

2 Likes

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!

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!

Hi,

Thanks again for your help.

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

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 ?

Thanks again!

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

Hi,

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 test.gh (7.8 KB)

Thanks!
Definitely a big step in the right direction:

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

Thanks again!

2 Likes

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

Thanks!

Thanks @HS_Kim

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

1 Like

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

Thanks @martinsiegrist and @HS_Kim it works!

1 Like