Skip to content

kernel: Union of perpendicular cylinders doesn't dedupe Steinmetz overlap #160

@ecto

Description

@ecto

Summary

Union of two equal cylinders meeting at right angles returns a volume equal to 2 × cylinder instead of 2 × cylinder − Steinmetz_overlap. The kernel appears to leave both cylinder surfaces in the output without computing or removing their intersection region.

Surfaced by mecheval/tasks/a3-cross-shaft-01.json, where 23 / 31 runs across all 6 models in the leaderboard fail mass_props with the exact same wrong volume — strong signal that the model output is fine and this is a deterministic kernel bug.

Reproduction

{
  "version": "0.1",
  "nodes": {
    "1": {"id": 1, "name": "vertical",   "op": {"type": "Cylinder", "radius": 10, "height": 40, "segments": 32}},
    "2": {"id": 2, "name": "horizontal", "op": {"type": "Cylinder", "radius": 10, "height": 40, "segments": 32}},
    "3": {"id": 3, "name": "h_rotated",  "op": {"type": "Rotate",   "child": 2, "angles": {"x": 0, "y": 90, "z": 0}}},
    "4": {"id": 4, "name": "h_pos",      "op": {"type": "Translate","child": 3, "offset": {"x": -20, "y": 0, "z": 20}}},
    "5": {"id": 5, "name": "cross",      "op": {"type": "Union",    "left": 1, "right": 4}}
  },
  "materials": {}, "part_materials": {},
  "roots": [{"root": 5, "material": "default"}]
}

Expected volume: 2·π·10²·40 − (16/3)·10³ = 25132.74 − 5333.33 = 19799.41 mm³
Actual volume: 24971.6 mm³ (kernel reports approximately 2× the cylinder volume — Steinmetz region is being double-counted)

Affected mecheval tasks

  • a3-cross-shaft-01 — 23 deterministic failures all reporting actual volume ≈ 24971.6, 0/31 pass-rate across Opus / Sonnet / Haiku / GPT-5 / GPT-5-mini / GPT-4o-mini

Probable root cause

In the SSI stage of the boolean pipeline, two perpendicular cylinders intersect along a pair of curves (two ellipse-like seams forming the boundary of the Steinmetz solid). If the SSI is missed or the cylindrical-face splits aren't classified, the trim/sew stage emits a result that contains both full cylinders' lateral surfaces overlapping in space — manifold is closed (each cylinder is closed on its own), but the volume integral over the unified mesh effectively double-counts the overlap region.

Worth a cargo test -p vcad-kernel-booleans --features debug-boolean test_perp_cylinder_union -- --nocapture run focused on the Cylinder × Cylinder SSI case in crates/vcad-kernel-booleans/src/ssi.rs.

Acceptance

Volume of cylinder(r=10, h=40, axis=Z) ∪ cylinder(r=10, h=40, axis=X, centered at z=20) returns 19799.41 ± 1%.

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingkernelRust kernel cratesrobustnessEdge cases / numerical robustness

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions