-
Notifications
You must be signed in to change notification settings - Fork 26
Revamp DCEL ghost edge algorithm #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The previous spanning tree approach connected arbitrary points from each component, which could create ghost lines that interfered with the geometry in problematic ways. The new algorithm: - Identifies connected components and their rightmost points - Casts horizontal rays rightward to find the closest intersection - Connects components that don't hit anything via a common vertical line This fixes several edge cases in set operations where ghost lines caused invalid DCEL construction.
a8b5db0 to
8ac15d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR revamps the DCEL ghost edge algorithm by replacing the previous spanning tree approach with a new ray-casting algorithm. The new implementation is more robust and prevents ghost lines from interfering with geometries in problematic ways.
Key Changes
- Replaced spanning tree ghost line construction with a ray-casting approach that finds connected components and links them using horizontal rays
- Updated test infrastructure to support pre-noded geometries with explicit ghost lines
- Fixed several geometry operation test cases that now produce different (more accurate) results due to the improved algorithm
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| geom/dcel_ghosts.go | Complete rewrite of ghost line generation using ray-casting instead of spanning tree |
| geom/dcel.go | Refactored to separate geometry preparation from DCEL construction |
| geom/dcel_internal_test.go | Updated test infrastructure to accept explicit ghost lines via new input structure |
| geom/dcel_ghosts_internal_test.go | Replaced spanning tree tests with new component representative and geometry preparation tests |
| geom/internal_test.go | Added new test helper functions for internal testing |
| geom/alg_set_op_test.go | Updated expected results for set operations and added new test cases |
| internal/cmprefimpl/cmpgeos/checks.go | Removed workarounds for previously failing cases |
| CHANGELOG.md | Documented the improvement |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
Description
Improves robustness of set operations (
Union,Intersection,Difference,SymmetricDifference) by revamping ghost line construction. The previousspanning tree approach could produce ghost lines that interfered with the
geometry in problematic ways. The new ray casting approach is more robust.