Skip to content

Add narrow cylinder lowering and boundary PointOnFixedEdge recovery#2

Draft
lucia3e8 wants to merge 1 commit intofix/degenerate-toroidal-surfacefrom
fix/degenerate-cylinder-lowering
Draft

Add narrow cylinder lowering and boundary PointOnFixedEdge recovery#2
lucia3e8 wants to merge 1 commit intofix/degenerate-toroidal-surfacefrom
fix/degenerate-cylinder-lowering

Conversation

@lucia3e8
Copy link
Copy Markdown

@lucia3e8 lucia3e8 commented Mar 24, 2026

Summary

  • Narrow cylinder theta-z lowering: for cylindrical faces with angular span < 30° (π/6), use (θ, z) coordinates instead of the default XY projection. The default projection collapses narrow cylinders to near-zero width, causing CDT failures.
  • Boundary PointOnFixedEdge recovery: when the CDT reports a boundary point lying on a constrained edge, find that edge and split it at the point, then retry. Previously only Steiner points had recovery (reassign to pts[0]); boundary points caused immediate failure.
    • Uses a relaxed epsilon fallback (1000× snap_eps) to catch nearly-collinear cases that the initial search misses

These fixes address the PointOnFixedEdge and HalfEdgeInvariant errors that appeared on component FH12-22S-0.5SH_55 after the previous CDT preprocessing changes.

Batch test: 90/92 maintained (no regression, prepares for next fix)

Test plan

🤖 Generated with Claude Code

Stack: 2/4 — prev: fix/degenerate-toroidal-surface, next: fix/collinear-perturbation


Note

Medium Risk
Touches core surface lowering and CDT error-recovery logic; while changes are targeted, they can affect mesh topology/quality and retry behavior on tricky geometry.

Overview
Adds a narrow-cylinder path for Surface::Cylinder that detects small angular spans during prepare() and lowers points using (theta, z) instead of the existing scaled-XY projection to avoid near-collinear 2D inputs.

Extends CDT retry handling in advanced_face so PointOnFixedEdge on boundary points triggers constrained-edge splitting (with a scale-relative snap_eps and a relaxed fallback), rather than failing immediately; Steiner-point recovery remains as point deduping.

Written by Cursor Bugbot for commit 4918813. This will update automatically on new commits. Configure here.

…covery

- Detect cylinder faces with <30 degree angular span ("narrow") and use
  theta-z lowering instead of scaled-XY, which degenerates for thin strips
- Add recovery for PointOnFixedEdge on boundary points: find and split the
  offending edge at the boundary point, then retry CDT
- Clone edges into catch_unwind closure to allow mutation during retries

Does not yet fix FH12-22S (HalfEdgeInvariant + collinear boundary) or
CONN-SMD_2309413-1 (WedgeEscape on complex multi-contour geometry).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

// projection degenerates (points become nearly collinear).
// Switch to theta-z lowering which works well for narrow strips.
let angular_span = angle_max - angle_min;
*narrow = angular_span < PI / 6.0;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Angular span calculation ignores atan2 wraparound at ±π

Medium Severity

The angular_span calculation uses angle_max - angle_min from raw atan2 values, which doesn't account for the discontinuity at ±π. atan2 returns values in (-π, π], so a narrow face positioned diametrically opposite the cylinder's ref_direction (near angle ±π) would have some vertices with angles just below π and others just above -π. This yields angular_span ≈ 2π instead of the true small span, causing narrow to be false when it needs to be true. The face then uses the degenerate scaled-XY projection — exactly the failure this PR aims to fix.

Fix in Cursor Fix in Web

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.

1 participant