Fix thin-face CDT failures via aspect ratio normalization#3
Fix thin-face CDT failures via aspect ratio normalization#3lucia3e8 wants to merge 1 commit intofix/degenerate-cylinder-loweringfrom
Conversation
When a face's 2D bounding box has extreme aspect ratio (<0.04 or >25), scale the thin axis to a target ratio before CDT. This prevents the CDT's exact predicates from seeing false collinearity among boundary points on very thin faces (e.g. narrow cylinder/plane strips). Also adds collinear perturbation utility (currently unused) and boundary PointOnFixedEdge recovery with relaxed epsilon. Test suite: 85/92 → 91/92 (98.9%). Only CONN-SMD_2309413-1 remains. 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 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| } else { | ||
| None | ||
| } | ||
| }; |
There was a problem hiding this comment.
Aspect scaling corrupts Steiner point 3D positions
Medium Severity
The aspect ratio normalization scales pts coordinates before surf.add_steiner_points() is called. For Sphere/Torus surfaces, add_steiner_points computes the bounding box from these scaled points, generates UV coordinates in the scaled space, and passes them to self.raise(uv) which expects original parametric coordinates. This produces incorrect 3D vertex positions for Steiner points. The aspect_scale variable stores the scaling info but is never used to compensate.
Additional Locations (1)
| if perturb_count > 0 { | ||
| info!("perturbed {} nearly-collinear points (diag={:.4e})", perturb_count, diag); | ||
| } | ||
| } |
There was a problem hiding this comment.
Function perturb_collinear_points is defined but never called
Low Severity
perturb_collinear_points is a new function (60+ lines) that is defined but never called anywhere in the codebase. It appears to be an alternative approach to the collinearity problem that was superseded by the aspect ratio normalization, but was left behind as dead code.


Summary
Add aspect ratio normalization before CDT: when the 2D bounding box of a face is extremely thin (ratio < 0.04 or > 25), scale the thin axis to bring the ratio closer to 1. This prevents CDT exact predicates from detecting false collinearity in faces that are geometrically thin strips.
The scaling is applied only to the 2D coordinates used for CDT triangulation — it does not affect the output 3D mesh vertices. After CDT, triangle indices reference the original unscaled vertex positions.
Thresholds chosen empirically to avoid regressions:
(0.5 * dy/dx).min(100)(2.0 * dx/dy).min(100)This fixes component FH12-22S-0.5SH_55 which has plane faces with aspect ratios around 0.001 (extremely thin horizontal strips where all boundary points project to nearly the same y-coordinate).
Batch test improvement: 90/92 → 91/92 (97.8% → 98.9%)
Test plan
cargo testpasses🤖 Generated with Claude Code
Note
Cursor Bugbot is generating a summary for commit 0c078b4. Configure here.