Drag the endpoints — watch the orientation tests and the intersection point update live.
| Test | cross | sign | meaning |
|---|
Proper crossing ⇔ o1≠o2 AND o3≠o4. A zero sign means an endpoint lies on the other line (boundary case).
| Operation | Time |
|---|---|
| cross / orientation | O(1) |
| do 2 segments intersect | O(1) |
| compute the point (Cramer) | O(1) |
| all-pairs brute force | O(n²) |
| all intersections (sweep) | O((n+k) log n) |