Single-plane profile_extrude produces wrong geometry + fitter regresses to 4 spheres on sample_plane_cyl.ply #24
Labels
No labels
blocked:needs-decision
blocked:preflight
bug
in-progress
in-progress
lint-cleanup
needs-decompose
quickfix
triage-approved
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/pc2cad#24
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Single-plane profile_extrude produces wrong geometry + fitter regresses to 4 spheres on
sample_plane_cyl.plyWhat happened
A side-by-side visual comparison of
samples/sample_plane_cyl.plyagainstthe reconstructed STEP exposes two problems. Both were caught on
2026-06-20 while testing the new single-plane extrude fallback that was
introduced in commit
16404ff.The input (7000 points, raw units = mm)
A vertical cylinder along the Z axis, ~30–40 mm diameter, ~100 mm tall,
intersected at mid-height by a horizontal plane slab parallel to the XY
plane, ~100×100 mm wide, ~1–2 mm thick.
The output (1 solid, 19 faces, 158 triangles)
A thin plate 0.05 × 0.05 × 0.01 in model units. The cylinder is
entirely missing. The plane's full ~100×100 mm footprint is
collapsed to a 50×50 mm convex hull of the fitter's plane inliers.
There is no curved surface, no hole, no trace of the cylinder.
Side-by-side
Two distinct bugs
Bug 1 — fitter regressed: cylinder → 4 spheres
The pre-
16404ffreport on this sample had primitivesplane + cone + sphere. The post-16404ffreport hasplane + 4 spheres + profile_extrude. The cylinder is being brokeninto 4 sphere fits instead of being classified as a cylinder.
This is the inverse of pc2cad#3 ("RANSAC primitive fitting unstable on
synthetic data — sphere misclassified as cylinder"). #3 is sphere
masquerading as a cylinder; #24 is the cylinder being broken into
spheres. Same underlying instability in the RANSAC search, opposite
direction. The cylinder's ~1000 axial points are being claimed greedily
by the densest 1000-point subset that happens to fit a sphere, and the
rest fragment into 3 more sphere fits.
Likely fix path (not for me to implement, the user said no local
patches): make the cylinder-vs-sphere RANSAC comparison penalize sphere
fits whose inlier distribution has high axial variance, or add a
post-RANSAC merge step that combines co-axial sphere fragments into a
cylinder. The original cone fit suggests this used to work; the new
profile_extrude emission may have changed segment assignment or
inlier-pool partitioning in a way that exposed the latent bug.
Bug 2 — single-plane extrude depth source is wrong
The new fallback in
derive_profile_operationspicks extrude depthfrom the nearest cone/cylinder's
t_max - t_min. When the fit producesno axial primitive (because of bug 1), the fallback falls through to
"10% of the polygon's largest extent" — which gave the 0.01 m
thickness. That number is meaningless on a plane slab that should
have a depth of 1–2 mm (matching the pointcloud's ~1–2 mm slab
thickness, not 10 mm).
Likely fix path (also not for me): when no axial primitive is found,
the depth should be estimated from the pointcloud's local density /
bbox along the plane's normal direction, not from the polygon's XY
extent. The current 10%-of-extents heuristic is a stopgap that's
silently producing a 10×-too-thick plate on real input.
A second-order observation: even with a correct depth, the plane
should be reconstructed as a true bounded slab (i.e. trimmed to the
actual 100×100 mm pointcloud extent, not the convex hull of the
fitter's 3146 plane inliers, which is only ~50×50 mm because the
fitter capped inlier count). The
polygonin the plane primitive isthe inlier hull, not the geometric extent. That's a separate concern
from bugs 1 and 2.
Verification commands
Related
bug 1 here)
rest of the export story
16404ff— the single-plane extrude fallback that exposedboth bugs
Closed — decomposed into three sub-issues on 2026-06-22:
Original body, attachments, and verification commands preserved here for reference. The three children carry the implementation work.