Skip to content

fix(tessellation): Delaunay meshing of curved trimmed faces, without needle triangles - #60

Open
Basnederveen wants to merge 4 commits into
OpenGeometry-io:mainfrom
Bas-Automation-Services:fix/curved-trim-delaunay
Open

Basnederveen wants to merge 4 commits into
OpenGeometry-io:mainfrom
Bas-Automation-Services:fix/curved-trim-delaunay

Conversation

@Basnederveen

@Basnederveen Basnederveen commented Nov 16, 2026 •

Copy link
Copy Markdown

What

Needle triangles on curved faces with holes or notches. general_curved_trimmed_face earcuts the trim ring in UV and refines edges that stray from the surface. Earcut produces long fans of needle triangles from the trim samples, and refinement only splits them further, so the mesh area overshoots the exact face: a half cylinder with a hole meshed +69 mm² at deflection 0.1, a curved slot through a cylinder +793 mm². At the finest deflections refinement could also stall against its 128 round cap.

  • Delaunay flips (new tessellation/delaunay.rs, Triangulation): after earcut, Lawson flips in UV scaled by the surface's uv_metric turn the fans into a Delaunay triangulation; trim edges stay fixed.
  • Refinement one edge at a time: a queue of edges, each split at its midpoint with local flips around the new vertex. No round cap, and it touches only the triangles it changes. edges_to_split, add_edge_midpoints and refined_triangles go.
  • Straight trim runs: earcut turned runs of collinear samples into zero-area triangles that flips and splits could not resolve. Samples now snap to a shared coordinate where they agree to the geometric accuracy (snap_axis_noise), earcut sees only each run's corners (straight_run_corners), and the run samples go back in by splitting the boundary edge they lie on.

Result on the two cases above: about −4.5 mm² (the inscribed-mesh deficit), with roughly 10× fewer triangles, and deflection 0.001 now meshes where it failed before.

Tests

  • New tessellation/tests/delaunay.rs: flips turn a fan of needles Delaunay; flips remove a flat triangle along a straight boundary; a split keeps the triangulation whole and Delaunay; samples along straight runs are inserted on the boundary.
  • cargo fmt --check, cargo clippy --all-targets -D warnings and the source rules pass. cargo test --all-targets --no-fail-fast: the same 6 tests fail as on main on this machine (Windows; wc_subtract, the stored-fixture batch/matrix/tessellation cases, golden scenes, IFC body digest), with identical output. The golden scenes may want re-recording where they were recorded, since curved trimmed faces now mesh differently.

Overlap

This branch is off main and touches trimmed_face.rs, as do #37 and #52, so they conflict textually. The fixes are independent; all three are combined on the fork's integration/3.0, whose test suite and downstream parts run on that combination. Happy to rebase this on whichever lands first.

Files

  • main/opengeometry/src/tessellation/delaunay.rs (new), mod.rs
  • main/opengeometry/src/tessellation/trimmed_face.rs
  • main/opengeometry/src/tessellation/tests/delaunay.rs (new), tests/mod.rs

🤖 Generated with Claude Code

…ipping locally

Splitting every deviating edge per round and re-flipping stalled near
finely sampled trims (a few dozen splits a round against a 128 round cap).
A queue of edges, each split at its midpoint with Lawson flips around it,
has no round cap and touches only the triangles it changes.
…triangles

Earcut turns runs of collinear trim samples (a straight trim edge in uv)
into zero-area triangles, which flips and splits cannot resolve: an edge
along the run met its own vertices and refinement either cycled or left
it unsplit. Samples now snap to a shared coordinate where they agree to
the geometric accuracy, earcut sees only the runs' corners, and the run
samples go back in by splitting the boundary edge they lie on. Flips use
one collinearity tolerance throughout.

This branch has not been deployed

No deployments
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