Draw line segments and find their intersections using computational geometry
Instructions
Click twice on the canvas to draw a line segment. Continue clicking to add more segments. The detector will automatically find and highlight all intersection points.
0
Line Segments
0
Intersections
Complete Line Segments
Current Drawing
Intersection Points
Endpoints
Intersection Details
Help
How to Use
Draw segments: Click twice on the canvas to create a line segment
Add more segments: Keep clicking to add additional line segments
View intersections: Red dots automatically appear where segments intersect
Clear canvas: Use the "Clear All" button to start over
Undo: Remove the most recently drawn segment
Line Intersection Algorithm
This app uses computational geometry to detect line segment intersections:
Basic approach: Checks all pairs of line segments for intersections
Intersection test: Uses vector cross products and parametric equations
Time complexity: O(n²) for n line segments (naive approach)
Practical optimization: Bentley-Ottmann sweep line algorithm can achieve O((n + k) log n) where k is the number of intersections