You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(common): extract shared PointXYZ / PCAFeature / plane-fit math (#94)
cpp/patchwork/ and cpp/patchworkpp/ each carried their own copies of
PointXYZ, PCAFeature, and the small geometry helpers (xy2theta,
xy2radius, point_z_cmp). The plane-fit SVD itself lived in three
slightly-different forms across cpp/patchwork/src/patchwork.cpp,
cpp/patchworkpp/src/patchworkpp.cpp, and the upstream
~/git/patchwork. PR #90 (Fix 2) was a concrete bug caused by that
drift.
This commit factors them into a new tiny static library:
cpp/common/
include/patchwork/types.h — PointXYZ, PCAFeature, PatchStatus
include/patchwork/plane_fit.h — xy2theta, xy2radius, point_z_cmp,
estimate_plane(seeds, out, th_dist)
src/plane_fit.cpp — SVD-based plane fit (single
canonical implementation)
PCAFeature now carries the `principal_` (largest singular vector)
field that exists in the original Patchwork repo; the classic
Patchwork's PCAFeature was missing it. The current pipeline does not
read `principal_` yet, but adding it costs ~12 bytes per patch and
keeps the type signature aligned with the original.
Dependents updated:
- cpp/patchwork/include/patchwork/patchwork.h: delete duplicated
PCAFeature/PatchStatus, include patchwork/types.h.
- cpp/patchwork/src/patchwork.cpp: delete in-class xy2theta /
xy2radius / estimate_plane, route call sites to the namespace-level
helpers in patchwork/plane_fit.h.
- cpp/patchworkpp/include/patchwork/patchworkpp.h: delete duplicated
PointXYZ + xy2theta / xy2radius member decls, include
patchwork/types.h.
- cpp/patchworkpp/src/patchworkpp.cpp: delete its file-scope
point_z_cmp and the PatchWorkpp::xy2theta / xy2radius definitions,
include patchwork/plane_fit.h.
`estimate_plane` is left untouched in patchworkpp.cpp (it still
writes to instance-level pc_mean_/normal_/singular_values_) because
refactoring it requires the thread-safety changes that will arrive
with the TBB work in the next PR.
CMake: new cpp/common/CMakeLists.txt builds ground_seg_common (static,
PIC) linked against Eigen3::Eigen. Both classic and patchworkpp link
to it. The patchworkpp build-tree export() set now also lists
ground_seg_common to keep find_package(patchworkpp) usable from a
build directory.
Numerical equivalence verified on KITTI 00-10 full sweep (23,201
frames) for all four method × protocol combinations against the
v1.3.1 baseline: every macro-average P / R / F1 cell within 0.0013 of
the v1.3.1 number (two combinations byte-identical), well under the
±0.05 budget set in the refactor plan.
Sets up the TBB parallelisation that will land in the follow-up PR.
0 commit comments