Skip to content

Conversation

@peterstace
Copy link
Owner

@peterstace peterstace commented Nov 7, 2025

Description

Improves robustness of set operations (Union, Intersection, Difference,
SymmetricDifference) by revamping ghost line construction. The previous
spanning tree approach could produce ghost lines that interfered with the
geometry in problematic ways. The new ray casting approach is more robust.

@peterstace peterstace self-assigned this Nov 7, 2025
@peterstace peterstace changed the title Remove old TestNoPanic test DRAFT/WIP: Revamp DCEL ghost edge algorithm Nov 7, 2025
@peterstace peterstace marked this pull request as draft November 7, 2025 03:05
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.
@peterstace peterstace force-pushed the revamp_ghost_construction branch from a8b5db0 to 8ac15d6 Compare December 4, 2025 23:56
@peterstace peterstace requested a review from Copilot December 5, 2025 00:04
@peterstace peterstace marked this pull request as ready for review December 5, 2025 00:04
Copy link

Copilot AI left a 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.

@peterstace peterstace changed the title DRAFT/WIP: Revamp DCEL ghost edge algorithm Revamp DCEL ghost edge algorithm Dec 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants