algorithmic modeling for Rhino
Hi! I try to check two lines whether they parallel or not. The first idea that comes into my head was check their intersection, but as you can see there when the lines slightly not parallels each other, there is two different point of intersection. Maybe i can use the fact that the points are different as the added condition, but how predictable this way is? Or maybe do you know better idea?
And by the way maybe they are parallel, i don't know because as figure out they have different length.
Tags:
How do you deal with parallel lines running in opposite directions?
Thank you very much, Phillip! Your definition works pretty good, though with this approach would be bit difficult to get the boolean answer. Much more important that i'm not clearly understanding how it's works :)
And thank for David Rutten, it's so obviously but i forgot about it :)
By the way in this particular case i always know the direction of the lines
It's amazing how simple can become a method, using just 2 components to achieve a complete new function!
Before reading here I neither know what vector cross product was...
gj
Wow - that's weird that Cross Product takes lines as inputs! Looks like it normalizes them into vectors also. Whoda thunk? There's nothing in the docs to say that - at least not in the docs for cross product. Is there some general principle in GH where lines are normally accepted in place of vectors? I tried passing a curve with three control points into cross product and it seems to convert that into the vector (0, 0, -1) which is kind of odd. You'd think they'd just reject it as bad input.
Vector Angle goes up to pi radians/180 degrees. So it'll give different angles for parallel and anti-parallel vectors. If you also want to find anti-parallel lines, then you should compare the angles to be [< t] OR [> (pi-t)]
if it is just about two lines that should be compared, why not simply reverse one of the vectors and check if they are parallel at the same time? if one of the two evaluations is true, they are parallel
Because usually in here less [components, data, computation time, obviousness,...] is more. In this sense most of the versions are more or less equal..., but the winner is still Daniel.
I´ll get some coffee.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by