Why it matters

Segment intersection is classic sweep. Understanding shapes technique.

Advertisement

The architecture

Sweep line events: endpoints + intersections.

Active: BBST by y at sweep.

Check neighbors for intersection.

Bentley-OttmannEndpoints + intersectionseventsBBSTactive segments by yCheck neighborsat each eventRequires careful degeneracy handling; robust predicates needed
Segment intersect.
Advertisement

How it works end to end

Insert start, remove end, swap on intersection.

Only adjacent pairs can intersect next.

Add intersections to event PQ.