M05_geometric_algorithm
M05_geometric_algorithm
Parametric equation:
(B − A) × (C − A)
Interpretation:
> 0: Points are in counterclockwise order.
< 0: Points are in clockwise order.
= 0: Points are collinear.
Intersection Criterion: Two segments P1 Q1 and P2 Q2 intersect if:
label=() orient(P1 , Q1 , P2 ) and orient(P1 , Q1 , Q2 ) have opposite signs, and
lbbel=() orient(P2 , Q2 , P1 ) and orient(P2 , Q2 , Q1 ) have opposite signs.
In the collinear case, additional checks on the projections are required.
Let
A = (1, 1), B = (10, 10), C = (3, 3), D = (5, 5).
All points lie on the line y = x (collinear). Since L6 (from C to D) lies
completely within L5 , the segments intersect (in fact, L6 is a subsegment
of L5 ).
Summary of Results:
(a) L1 and L2 intersect.
(b) L3 and L4 do not intersect.
(c) L5 and L6 intersect (collinear overlapping).
(d) L7 and L8 intersect.
Questions?