Fixed: Correctly wires neighbors after K2 flips#191
Conversation
Fixes an issue where external neighbors across the cavity boundary were not being correctly rewired after a K2 flip. Introduces `external_facets_for_boundary` to collect the set of external facets that are shared with the flip cavity boundary, and then uses these to correctly wire up neighbors. Adds a test case to verify that external neighbors are correctly rewired after the flip, ensuring that the triangulation remains valid and consistent. Refs: refactor/wire-cavity-neighbors
WalkthroughIntroduces boundary-aware neighbor wiring: extract the cavity boundary, derive external boundary facets, and pass those facets into the neighbor-wiring step so newly inserted cells are wired to the correct external neighbors across the cavity boundary. Changes
Sequence Diagram(s)sequenceDiagram
participant Inserter
participant CavityBoundary
participant ExternalFinder
participant Wirer
participant Tds
Inserter->>CavityBoundary: identify internal conflict cells & boundary_facets
CavityBoundary->>ExternalFinder: provide internal cells + boundary_facets
ExternalFinder->>Tds: scan neighbor candidates, collect external facet handles
ExternalFinder-->>Inserter: return external_facets
Inserter->>Wirer: call wire_cavity_neighbors(new_cells, external_facets, conflict_cells)
Wirer->>Tds: build facet incident map, create wiring pairs, attach new↔external neighbors
Wirer-->>Inserter: success / FlipError::NeighborWiring on failure
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
Adds a test to verify correct rewiring of external neighbors after a k=3 flip. This validates the boundary handling and neighbor update logic in the bistellar flip implementation. This test constructs an explicit k=3 ridge-flip fixture and checks neighbor rewiring.
Fixes an issue where external neighbors across the cavity boundary were not being correctly rewired after a K2 flip.
Introduces
external_facets_for_boundaryto collect the set of external facets that are shared with the flip cavity boundary, and then uses these to correctly wire up neighbors.Adds a test case to verify that external neighbors are correctly rewired after the flip, ensuring that the triangulation remains valid and consistent.
Refs: refactor/wire-cavity-neighbors