Files
solidcraft-upstream/tests/oracle
bherbruckandClaude Opus 5.5 57e6396fbb Tangent hole contacts split no faces, consistently (#307) (#364)
* Tangent hole contacts: every symmetric contact gives the same faces (#307)

Three things made the four symmetric contacts of reference case 42 differ:

- The 2D prism boolean's ray-parity test miscounted a ray grazing the bottom
  of a patterned hole, whose two halves are read back with centres a few ulps
  apart: one half counted the touch, the other missed it. The loop chaining
  then failed and those cuts fell back to the general boolean, which treats
  circles tangent within its tolerance as overlapping and splits the hole.
  The ray is now moved off vertices and arc extremes by far less than any
  modelling tolerance.
- The prism result's volume check used a coarser mesh than the operands, so
  a plate with many holes read too large and correct results were rejected.
- The merged topology did not join a hole's two pieces across the line where
  two tangent holes touch (four faces meet there).

Case 42 now gives 39 faces (33 holes, 6 planes); its expected.json pins it.

Fixes #307

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT

* Kernel test: tangent hole pinch no longer splits the wall (#307)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RjGw4gA5ZvKrU8MQP6sBgT

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-10-12 15:01:03 -04:00
..

Reference tests (the oracle)

Each directory is one case:

  • recipe.json: the part, written in SolidCraft's recipe format (sketches in sketch-local coordinates, features with their parameters, faces and edges picked by a world-space point). cargo xtask oracle replays it through SolidCraft's command engine.
  • expected.json: what the part must measure, and where those numbers come from.
  • reference.stl (optional): a fine triangulation of the expected part, used to check the shape itself (surface distance), not only its totals.

Run every case with cargo xtask oracle; it writes docs/oracle.md.

expected.json

{
  "source": "analytic",
  "method": "box 40 x 30 x 20: V = abc, A = 2(ab + bc + ca)",
  "body_count": 1,
  "volume_mm3": 24000.0,
  "area_mm2": 5200.0,
  "center_of_mass": [20.0, 15.0, 10.0],
  "bbox": { "min": [0.0, 0.0, 0.0], "max": [40.0, 30.0, 20.0] },
  "faces": 6
}
Field Meaning
source "analytic" (closed-form geometry, worked out by hand; method gives the formulas) or "freecad <version>" (built from the same recipe by tools/freecad-oracle/).
method How the numbers were obtained: formulas for analytic cases, the construction for FreeCAD ones.
body_count Number of solid bodies.
volume_mm3, area_mm2 Totals over all bodies.
center_of_mass Volume-weighted centroid of all bodies (uniform density).
bbox Axis-aligned bounding box of all bodies.
faces Optional. Only where the geometry fixes the count: a face is a maximal smooth patch of one surface (a full cylinder side is one face; coplanar neighbours are one face).
compare Optional. Restricts the comparison to these keys (for example ["volume_mm3", "area_mm2"] where kernels legitimately build different corner patches); note says why.
tolerance Optional overrides: rel (volume, area; default 1e-3), abs_mm (centre of mass and bbox, default 1e-3 × the bbox diagonal), surface_mm (STL surface distance).
note Optional remarks.

No value here was measured in, or exported from, any commercial CAD product.