Skip to main content

Module icp

Module icp 

Source
Expand description

Rigid registration: point-to-plane ICP against a mesh and its BVH.

icp() moves a cloud of points onto a fixed mesh. Each iteration finds every point’s closest point on the mesh with the BVH, keeps the closest overlap fraction of them (trimmed ICP, so a partial overlap and outliers do not pull the result), and solves one linearised least-squares step for the rotation and translation that reduce the distances to those triangles’ planes.

The iteration is local: it starts at the initial transform and finds the nearest minimum, so the start has to be roughly right. “Converged” means the iteration stopped moving with every degree of freedom constrained, not that the alignment is the right one: read IcpReport::rmse for that.

Directions with no constraint at all (a plane sliding in its own plane, a tube along its axis) are left out of each step instead of being solved from rounding noise.

A settled iteration does not show that the data chose its pose: the facets of a tessellated sphere, or noise on a plane, give every step something to fit, so the normal equations look well conditioned and the iteration settles on an arbitrary spin or slide. So icp() checks. Along each of the six eigenmotions it displaces the pose and iterates again, on at most 10,000 of the points. A pose is determined along a motion when the restart comes back, or ends somewhere that fits clearly worse. When it stays displaced with a fit as good, the data do not choose, and the motion is reported in IcpReport::undetermined with the status IcpStatus::Underconstrained. This is a local test: a symmetry farther away than the displacements (a cube turned by 90 degrees) is not seen.

Structs§

IcpMotion
A rigid motion the data do not determine, in the fixed mesh’s local coordinates: a point p moves along translation + rotation x (p - about), scaled so that the points move by 1 (root mean square).
IcpOptions
Options for icp().
IcpReport
What icp() found. Every number is finite, except that rmse is infinite when no point has a correspondence. rmse is measured in f64 from the points to the chosen triangles.

Enums§

IcpStatus
Why icp() stopped.

Functions§

icp
Aligns points to the mesh fixed by rigid, point-to-plane ICP, starting from initial. See the module docs.
sample_surface
Up to max_samples evenly spaced points on the surface of mesh, in its stored local coordinates, without the origin: its triangles’ centroids, then the vertices its triangles use, the first of each stride of the two lists together.