Reply To: Detecting Line Intersection

Home Forums Problems and solutions in GDL Object design Detecting Line Intersection Reply To: Detecting Line Intersection

Péter Baksa

Hi James,

The direction vectors are unit vectors along the lines, their length have to be exactly 1 (meter). Compute the length of the vector between the two points on the line, and to set the vector length to 1, multiply its end coordinates by 1/length.

If you use an EPS value that is common in GS libparts, this code has a small bug, the lines are treated parallel (no intersections) when their angle is smaller than 0.81°, which is still quite noticable. Using EPS = 0.00000001 will set the limit to 0.0081°

Péter Baksa
Library Platform, Software Engineer