fix(compose): gate post-synthesis feature sweep in _compose_engine_reconstruction #81

Closed
opened 2026-09-19 06:19:39 +00:00 by Mark · 1 comment
Owner

After 4 fix commits landed on Mark/pc2cad#77 (89ed113, 9c471f3, dbf6124, c0e076f), pc2cad_cli.py samples/methodology_assembly.ply --engine compose --deterministic-ransac --seed 42 still ends with Exported body+features reconstruction (body=compose_solid, features=2) to ....

Root cause: _compose_engine_reconstruction (~line 1711, pc2cad_compose.py) calls _find_feature_cylinders(...) unconditionally for compose_solid bodies. min_inliers=max(60, int(0.01*len(points))) is too loose -- 5000 plane points -> 60 inlier threshold is noise. Two spurious features still slip through.

Fix: skip the sweep when the body's primitive set has no cylinder/cone/sphere, OR raise min_inliers>=500 for plane-only bodies. Add regression test in tests/test_compose.py asserting features=0 on the above CLI invocation.

After 4 fix commits landed on Mark/pc2cad#77 (89ed113, 9c471f3, dbf6124, c0e076f), `pc2cad_cli.py samples/methodology_assembly.ply --engine compose --deterministic-ransac --seed 42` still ends with `Exported body+features reconstruction (body=compose_solid, features=2) to ...`. Root cause: `_compose_engine_reconstruction` (~line 1711, pc2cad_compose.py) calls `_find_feature_cylinders(...)` unconditionally for compose_solid bodies. `min_inliers=max(60, int(0.01*len(points)))` is too loose -- 5000 plane points -> 60 inlier threshold is noise. Two spurious features still slip through. Fix: skip the sweep when the body's primitive set has no cylinder/cone/sphere, OR raise `min_inliers>=500` for plane-only bodies. Add regression test in tests/test_compose.py asserting `features=0` on the above CLI invocation.
Author
Owner

Fixed via commit c6f901f on Mark/pc2cad main.

_compose_engine_reconstruction now gates _find_feature_cylinders
on whether the bodies that compose the synthesized solid actually
contain a curved primitive (cylinder / cone / sphere). The sweep
exists to recover curved features plane RANSAC swallowed (bolt
circles, bores); for a plane-only body there is nothing it could
legitimately find, and the loose min_inliers cap was admitting
spurious cylinders from radial noise on the 6000 plane points.

Verified end-to-end:

  • pc2cad_cli.py samples/methodology_assembly.ply --engine compose --deterministic-ransac --seed 42 → features=0 (was 2)
  • pc2cad_cli.py samples/methodology_shaft.ply ... → features=1 (real central bore, unchanged)
  • 63/63 tests in tests/test_compose.py + tests/test_reconstruction.py + tests/test_cli_mode.py + tests/test_holes.py pass

Regression test: tests/test_compose.py::test_compose_engine_skips_feature_sweep_for_plane_only_body

Fixed via commit c6f901f on Mark/pc2cad main. `_compose_engine_reconstruction` now gates `_find_feature_cylinders` on whether the bodies that compose the synthesized solid actually contain a curved primitive (cylinder / cone / sphere). The sweep exists to recover curved features plane RANSAC swallowed (bolt circles, bores); for a plane-only body there is nothing it could legitimately find, and the loose `min_inliers` cap was admitting spurious cylinders from radial noise on the 6000 plane points. Verified end-to-end: * `pc2cad_cli.py samples/methodology_assembly.ply --engine compose --deterministic-ransac --seed 42` → `features=0` (was 2) * `pc2cad_cli.py samples/methodology_shaft.ply ...` → `features=1` (real central bore, unchanged) * 63/63 tests in tests/test_compose.py + tests/test_reconstruction.py + tests/test_cli_mode.py + tests/test_holes.py pass Regression test: tests/test_compose.py::test_compose_engine_skips_feature_sweep_for_plane_only_body
Mark closed this issue 2026-09-19 07:11:04 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/pc2cad#81
No description provided.