Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 5938

How can parallel line segments intersect at parameter 0.5?

$
0
0

Hi,

I’m working on a script that iteratively checks for line-line-intersections of a set of line segments that lie within the same plane.

I’ve noticed that sometimes, two nearly parallel line segments have an intersection at a parameter very close to 0.5, which roughly translates to a mid point.

For the top line segment the intersection parameter is found at 0.5039106145251397 and for the bottom one at 0.49497206703910607.

I’m using Rhino.Geometry.Intersect.Intersection.LineLine() to compute the intersections.

I would like to understand what causes this?

I’ve currently fixed the bug that thus emerged, by computing the “two-dimensional” vector cross product of the line segment directions and checking its z-value as a scalar.
If this scalar is between the negative and positive absolute model tolerance (i.e. 0.001), I simply skip the intersection computation for near parallel lines.

This fixes the issue, but I would still want to know how this happens!

Thanks for taking a look.

parallel_intersection.gh (3.4 KB)

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 5938

Trending Articles