Conversation
- Convert CDT expect()/assert() panics in walk_fill to return HalfEdgeInvariant errors instead, preventing process-level panics on degenerate multi-contour geometry - Add rotation retry: when CDT fails with CrossingFixedEdge, WedgeEscape, or HalfEdgeInvariant, retry with multiple rotated 2D coordinate systems (0.123, 0.347, 0.789, 1.234 radians) - Add remove_crossing_edges() for rotation retry path where we can't add new 3D vertices — removes shorter edge in crossing pairs - Add T-intersection resolution and duplicate edge removal in rotation retry path - Add duplicate edge removal (HashSet dedup) in resolve_crossing_edges - Expand Phase 2 T-intersection check to cover all points (including those added by Phase 1 crossing resolution), increase iteration limit - Remove unused perturb_collinear_points() function CONN-SMD_2309413-1: reduced from 5 face errors to 2 (3 faces now succeed via rotation retry). Remaining: face 106344 (HalfEdgeInvariant, collinear plane) and face 337698 (WedgeEscape). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| ((xmax - xmin).powi(2) + (ymax - ymin).powi(2)).sqrt() | ||
| }; | ||
| let t_eps = if diag > 1e-15 { diag * 1e-7 } else { 1e-12 }; | ||
| for _ in 0..200 { |
There was a problem hiding this comment.
Retry path uses lower T-intersection iteration limit than main path
Medium Severity
The T-intersection resolution loop in the rotation retry path uses 0..200 iterations, while this same PR increased the equivalent loop in resolve_crossing_edges from 200 to 0..500. Since the retry path specifically targets complex geometries that already failed the main CDT, these cases are more likely to need the higher limit. An incomplete T-intersection resolution could leave near-collinear points unresolved, causing the retry CDT to fail unnecessarily.
Additional Locations (1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Improve CDT robustness for complex multi-contour geometry, specifically targeting CONN-SMD_2309413-1 (the last failing component with 73 face bounds on a single face).
Changes
CDT panic → error conversion (
cdt/src/triangulate.rs):.expect()calls and 2assert!()checks inwalk_fillto returnErr(HalfEdgeInvariant)instead of panicking. These panics occurred on complex multi-contour faces where contour triangulation failed to produce expected edges.Rotation retry (
triangulate/src/triangulate.rs):CrossingFixedEdge,WedgeEscape, orHalfEdgeInvariant, retry with up to 4 rotated 2D coordinate systems (0.123, 0.347, 0.789, 1.234 radians)remove_crossing_edges()(drops shorter edge in crossing pairs) since we can't add new 3D vertices in the retry pathEdge preprocessing improvements:
perturb_collinear_points()functionResults
CONN-SMD_2309413-1 face errors reduced 5 → 2:
CrossingFixedEdge→ fixed by rotationWedgeEscape→ fixed by rotationHalfEdgeInvariant(was panic) → fixed by rotationHalfEdgeInvariant— all boundary points collinear at x=402WedgeEscape— CDT walk escapes hullBatch test: 91/92 maintained (CONN-SMD still counted as failing due to 2 remaining face errors, but significantly improved)
Remaining work for CONN-SMD_2309413-1
The 2 remaining face failures are caused by degenerate plane projections where the plane's reference direction aligns with the face's thin dimension, collapsing all boundary points to a line in 2D. Possible future fixes:
Test plan
cargo testpasses🤖 Generated with Claude Code
Note
Medium Risk
Moderate risk: changes error handling and adds a lossy retry path that can drop constrained edges to make triangulation succeed, which may alter mesh output for some degenerate/crossing inputs.
Overview
Improves triangulation robustness by replacing several
assert!/.expect()panics incdt::Triangulation::walk_fillwithError::HalfEdgeInvariantreturns when half-edge/hull invariants don’t hold.When CDT fails with
CrossingFixedEdge,WedgeEscape, orHalfEdgeInvariant, the higher-level triangulator now retries by rotating the 2D projection through a few fixed angles and re-running edge pre-processing before attempting CDT again.Edge pre-processing is tightened by (a) expanding T-intersection splitting to consider all points (including those introduced by crossing resolution), (b) increasing iteration limits, (c) removing a collinearity-perturbation approach in favor of
remove_crossing_edges(drops the shorter edge on crossings in the rotation retry path), and (d) deduplicating duplicate edges after splitting.Written by Cursor Bugbot for commit 8690327. This will update automatically on new commits. Configure here.