Skip to content

fix(booleans): exact cylinder minus half-space cuboid with ellipse trims - #28

Merged
aka-blackboots merged 2 commits into
mainfrom
fix/plane-cylinder-ellipse-boolean
Oct 24, 2026
Merged

aka-blackboots merged 2 commits into
mainfrom
fix/plane-cylinder-ellipse-boolean

Conversation

@aka-blackboots

Copy link
Copy Markdown
Contributor

What

Exact Boolean for a full cylinder minus a half-space cuboid (one face plane cuts the cylinder).

Before, this cut failed when the plane was oblique to the cylinder axis (coverage gap), or parallel to a sloped axis (SSI support residual). Now the kept part is built directly:

  • the side, trimmed by the exact cut ellipse (parameter = cylinder angle), or by two rulings when the plane is parallel to the axis;
  • full or chord-clipped caps;
  • one planar cut face.

Aligned subtractions keep their existing builders.

Robustness

  • The chart is built from cross products, so near-perpendicular cuts keep an orthonormal frame.
  • The near-parallel guard is a rounding bound on the ellipse centre and amplitude, not an absolute value.
  • Only exact results and UnresolvedIntersection replace the original error; other failures keep the generic fallbacks.
  • Cuts within 1e-3 r of a side or rim (tessellation slivers) go to the other paths.

Tests

  • 9 new crate tests in analytic/booleans/cylinder_half_space.rs (oblique, perpendicular, parallel, sloped axis, near-rim probe families): all pass.
  • cargo test --release: 439 pass, 2 fail. The same 2 tests also fail on main at release: 2.0.18 without this change, so they are not caused by it:
    • analytic::tessellation::tests::a_trimmed_curved_face_keeps_its_triangle_set
    • analytic::wasm::tests::text_and_object_tessellation_give_the_pinned_triangles

Files

  • main/opengeometry/src/analytic/booleans.rs
  • main/opengeometry/src/analytic/booleans/cylinder_half_space.rs (new)

A full cylinder cut by one cuboid face plane failed when the plane was
oblique to the axis (coverage gap) or parallel to a sloped axis (SSI
support residual). Build the kept part directly: the side trimmed by
the cut ellipse (parameter = cylinder angle) or two rulings, full or
chord-clipped caps, and one planar cut face. Aligned subtractions keep
their existing builders.
- Build the chart from cross products so near-perpendicular cuts keep an
  orthonormal frame.
- Replace the absolute near-parallel guard with a rounding bound on the
  ellipse centre and amplitude.
- Only exact results and UnresolvedIntersection replace the original
  error; other failures keep the generic fallbacks.
- Leave cuts within 1e-3 r of a side or rim (tessellation slivers) to
  the other paths.
- Add the reviewer's probe families as crate tests.
@aka-blackboots
aka-blackboots merged commit 46de326 into main Oct 24, 2026
3 checks passed
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