Skip to content

Add DegenerateToroidalSurface support and CDT edge preprocessing#1

Draft
lucia3e8 wants to merge 1 commit intomasterfrom
fix/degenerate-toroidal-surface
Draft

Add DegenerateToroidalSurface support and CDT edge preprocessing#1
lucia3e8 wants to merge 1 commit intomasterfrom
fix/degenerate-toroidal-surface

Conversation

@lucia3e8
Copy link
Copy Markdown

@lucia3e8 lucia3e8 commented Mar 24, 2026

Summary

  • Add DegenerateToroidalSurface as a torus variant in get_surface() — this STEP entity was unhandled, causing UnknownSurfaceType errors on component 693072010801
  • Add CDT edge preprocessing in resolve_crossing_edges():
    • Point deduplication (dedup_close_points): snap nearly-coincident 2D boundary points to prevent phantom crossings from surface lowering numerical noise
    • T-intersection detection (point_near_segment): split constrained edges when a boundary vertex lies within ε of a non-adjacent edge, preventing CrossingFixedEdge from CDT exact predicates
    • Crossing resolution: when two constrained edges genuinely cross in 2D, split both at the intersection point by inserting a shared vertex

These fixes address CrossingFixedEdge errors on 4 components (XT30PW-F, SRP5030CA-4R7M, SRP6050CA-4R3M, KEY-SMD_4P) and the UnknownSurfaceType error on 693072010801.

Batch test improvement: 85/92 → 90/92 (92.4% → 97.8%)

Component Issue Fix
693072010801 DegenerateToroidalSurface not handled Added as torus variant
XT30PW-F CrossingFixedEdge on torus faces CDT edge preprocessing
SRP5030CA-4R7M CrossingFixedEdge CDT edge preprocessing
SRP6050CA-4R3M CrossingFixedEdge CDT edge preprocessing
KEY-SMD_4P CrossingFixedEdge (bowtie topology) CDT edge preprocessing

Test plan

  • cargo test passes
  • Batch test against Diode component dataset: 90/92 pass (vs 85/92 baseline)
  • No regressions on previously-passing components
  • Verify 693072010801.step produces valid STL output
  • Verify XT30PW-F.step no longer panics/errors

🤖 Generated with Claude Code

Stack: 1/4 — next: fix/degenerate-cylinder-lowering


Note

Medium Risk
Medium risk: changes affect geometric preprocessing and constrained triangulation inputs, which can alter tessellation output and performance or introduce edge-case failures on complex faces.

Overview
Adds support for STEP DegenerateToroidalSurface by treating it as a torus in get_surface(), avoiding UnknownSurfaceType errors.

Hardens CDT input generation in resolve_crossing_edges() by deduplicating nearly-coincident boundary points, tightening/adjusting intersection tolerances, and adding a second pass to split edges on near vertex-on-edge (T) intersections, in addition to existing edge-edge crossing splits.

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

- Handle DegenerateToroidalSurface (minor_radius >= major_radius) by
  treating it as a regular torus surface for tessellation
- Add point deduplication pass to snap nearly-coincident 2D points before
  CDT, preventing phantom edge crossings from numerical noise
- Add T-intersection detection: split constrained edges when a boundary
  vertex lies very close to (but not at the endpoint of) another edge
- Increase crossing resolution iteration limit from 100 to 200
- Use tighter denom threshold (1e-15) in segment intersection test

Fixes 5 additional components: XT30PW-F, SRP5030CA-4R7M, SRP6050CA-4R3M,
KEY-SMD_4P, 693072010801 (partially). Test suite: 85/92 → 90/92.

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.

}

// Remove degenerate edges (where src == dst after remapping)
edges.retain(|e| e.0 != e.1);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Dedup can collapse into duplicate constraints

High Severity

After remapping close points, edges only removes self-loops. Distinct edges can collapse to the same undirected pair (including reversed order), leaving duplicate constrained edges that change CDT boundary parity and can misclassify interior/exterior regions.

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