Files
Java/src/test/java/com/thealgorithms/geometry
Indolyn Yi 2da0465fe0 feat(geometry): Add Bentley-Ottmann algorithm for line segment intersection (#6871)
* feat(geometry): add Bentley-Ottmann line segment intersection algorithm

- Implement sweep-line algorithm for finding all intersection points
- Time complexity: O((n + k) log n) where n is segments, k is intersections
- Uses event queue (PriorityQueue) and status structure (TreeSet)
- Handles vertical/horizontal segments, collinear overlaps, and touching endpoints
- Includes comprehensive Javadoc with examples and references

* test(geometry): add comprehensive tests for Bentley-Ottmann algorithm

- 19 test cases covering typical, edge, and degenerate cases
- Tests include: single/multiple intersections, parallel segments, grid patterns
- Performance test with 100 random segments
- All tests validate correctness of intersection detection

* style(geometry): fix code style

* test(geometry): Achieve 100% test coverage for BentleyOttmann

* style(geometry): fix code style again

* fix: correct import order in BentleyOttmann

* fix(geometry): Resolve SpotBugs and PMD static analysis warnings

* Reorder import statements in BentleyOttmannTest

---------

Co-authored-by: Deniz Altunkapan <deniz.altunkapan@outlook.com>
2025-10-25 22:18:45 +02:00
..