Skip to content

feat(occtkit): measure-deviation verb + metrics boundingBoxOptimal#59

Merged
gsdali merged 1 commit into
mainfrom
feat/measure-deviation-verb
Jun 19, 2026
Merged

feat(occtkit): measure-deviation verb + metrics boundingBoxOptimal#59
gsdali merged 1 commit into
mainfrom
feat/measure-deviation-verb

Conversation

@gsdali

@gsdali gsdali commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Brings two introspection capabilities to occtkit so OCCTMCP's Node server (an occtkit-verb wrapper) can reach parity with the Swift server, which already has both in-process.

measure-deviation <a.brep> <b.brep> [--deflection D] [--max-samples N]

Directed + symmetric surface deviation (one-sided / symmetric Hausdorff). measure-distance returns the minimum gap — ≈0 for an overlapping reconstruction-vs-source pair, useless as a fidelity figure. This samples each shape's tessellated surface and projects onto the other's triangles:

  • Meshes both shapes; --deflection defaults to 0.5% of the a-shape bbox diagonal.
  • Per sampled vertex → exact closest point on the other's triangles (KD-tree nearest vertices → incident triangles → point-to-triangle, Ericson §5.1.5). Both directions.
  • Emits {max, rms, mean, worstPoint, samples} for fromToTo / toToFrom + symmetricHausdorff. --max-samples (default 20000) stride-subsamples the source.

metrics --metrics …,boundingBoxOptimal

Opt-in tight extent (BRepBndLib::AddOptimal). The default Bnd_Box over-reports curved B-spline faces (control-point hull); the optimal box is tight for curved geometry and equal for planar. Default-all set unchanged. (OCCTMCP #44)

Verification

Built -c release; tested with generated BREPs:

  • coaxial cylinders Δr=0.5 → symmetricHausdorff ≈ 0.52 (the radial gap)
  • boundingBoxOptimal tight (5.5/20) vs Bnd_Box epsilon; omitted unless requested

README introspection row + Makefile VERBS updated.

🤖 Generated with Claude Code

Adds the two introspection capabilities OCCTMCP's Swift server grew, so the
Node server (an occtkit-verb wrapper) can reach surface parity.

- `measure-deviation <a.brep> <b.brep> [--deflection D] [--max-samples N]`:
  directed + symmetric surface Hausdorff. Meshes both shapes (deflection
  defaults to 0.5% of the a-shape bbox diagonal), then for each sampled vertex
  of one finds the exact closest point on the other's triangles (KD-tree
  nearest vertices → incident triangles → point-to-triangle, Ericson). Reports
  {max,rms,mean,worstPoint,samples} per direction + symmetricHausdorff. The
  certify-a-reconstruction metric measure-distance can't give (min-only).

- `metrics --metrics ...,boundingBoxOptimal`: opt-in tight extent
  (BRepBndLib::AddOptimal); the default Bnd_Box over-reports curved B-spline
  faces (control-point hull). Default-all unchanged. (OCCTMCP #44)

Verified: coaxial cylinders Δr=0.5 → symmetricHausdorff ≈0.52; optimal box
tight vs Bnd_Box epsilon.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gsdali gsdali merged commit 5aa3b06 into main Jun 19, 2026
0 of 2 checks passed
@gsdali gsdali deleted the feat/measure-deviation-verb branch June 19, 2026 23:27
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