Split diagonal Line in two orthogonal lines

Hello there,
I have a seemingly simple problem in Grasshopper and hope to find help here.

There are two points connected by a diagonal line (blue line). Now I would like to divide this line into two orthogonal lines. I already found this in another forum entry, but this function only works with deconstruct vector. This only works if you want to split in x and y direction. (Red line)

However, I must be able to determine the direction of the orthogonal vectors myself. (For example green line)

I would be very grateful for your help!


I think you want to have a look at the trigonometry component. Couldn’t be one possible solution to this.

Hey Tim, thanks for your quick answer. Could you please explain to me how you would use this to solve this problem? I’m a beginner at Grasshopper, sorry. Do I have to change alpha?

Then I would have to set my diagonal line as R, alpha is my vector angle? Do I get it right?

How do I get the two lines out of this component?

Construct a circle centered on the midpoint of the line, with the line as a diameter. Lines from any point on the circle to the endpoints of the line will be orthogonal - it’s geometry.

orthogonal lines.gh (8.4 KB)

Wow, I didnt think of that! Many thanks Ethan! Just one other point. One of the two new lines has to be on the same vector as a third line that I define seperatly. How can I set the angle? I guess I’m too bad in maths to solve this in the circle?

What I mean:

The blue line has to have the same angle as the green line.

Of course, nothing stays simple for long… This should work but I also had to reset the circle seam to the origin to avoid some issues.

Edit: I forgot to internalize the reference line.
orthogonal lines2.gh (10.2 KB)

Sorry for the late answer, I had to try it on my Problem. And it works perfectly! Many many thanks!

Can anyone tell me why the intersections are not recognized in part?

Problem Grasshopper.gh (17.1 KB)

Normally, I enter the diagonal lines automatically, in some constellations the definition works, in others not. I don’t know why?

I think its because in your second example some pairs of initial points do not all lie in the same xy plane - take a look, the z’s sometimes differ, so the line connecting them will not intersect the circle, which is always in the xy plane.

Oh, I didnt see this! Thank you so much!