0
$\begingroup$

To find if two line segments intersect I am this code

The problem is this code:

// if abs(angle)==1 then the lines are parallell,   // so no intersection is possible   if(abs(deg)==1) return null; 

At that point we know that the lines are parallel, but we don't know if they overlap and where.

If I have a line segment 5,5 to 10,10 and another line segment 7,7 to 12,12 then I'd like to determine that the line segment 7,7 to 10,10 is the overlap.

4 Answers 4