Skip to main content

Module register

Module register 

Source
Expand description

Rigid registration: the rotation and translation that best carry one set of points onto another, onto a mesh, or a part onto its own mirror image.

  • absolute_orientation is the closed form for paired points.
  • icp registers points onto a mesh through its Bvh, pairing each point with its nearest point on the mesh and solving again until the pairs stop moving.
  • symmetry_plane finds the plane a part is the mirror image of itself in.

The linear algebra is nalgebra’s: a symmetric eigen-decomposition for the quaternion of the closed form and for the normal matrix of each point-to-plane step. Every sum runs over the pairs in their order and the nearest-point queries are to_mesh’s, so every answer is the same bit for bit on any thread count.

§Iterative closest points

Each round moves the samples by the transform so far, finds each one’s nearest point on the mesh (within Icp::max_distance, and with Icp::facing_limit among the triangles facing within the limit of the sample’s own normal), keeps the pairs within Icp::cutoff’s threshold over the round’s distances, and solves for an increment from the kept pairs:

  • point to plane (the default): the small rotation and translation that minimise the squared distances of the samples to the planes through their nearest points, square to the mesh’s normal there (the face’s, or the pseudonormal at an edge or a corner). The increment is solved about the kept samples’ centroid with the rotation measured in lengths at their RMS radius, so its six unknowns are commensurate, and its rotation is applied exactly;
  • point to point: the absolute_orientation of the kept pairs.

The rounds stop once an increment moves no kept sample further than the confusion distance, which is convergence, or after Icp::max_iter rounds. Each start of Icp::starts is run so, and the one with the least Registration::score wins, ties going to the earlier start. The score is the mean distance of every sample, each capped (at Icp::max_distance, or the mesh’s diagonal where there is none) and a sample with no pair counting as the cap, so a start that pairs a few samples closely and leaves the rest does not beat one that pairs them all.

§Free motions

Where the pairs cannot hold a motion (the samples of one flat face can slide in its plane and spin about its normal), the point-to-plane normal matrix is singular along it. A step moves only along the directions whose eigenvalues stand above what rounding of the matrix’s sums could make of zero, and the registration reports the rest as Registration::free_directions: the eigenvectors whose eigenvalues are no larger than the largest times (σ/r)², σ the RMS point-to-plane residual and r the samples’ RMS radius. Moving along such a direction by the whole radius changes the residuals no more than moving along the best-held direction by the noise does.

Structs§

FreeMotion
A rigid motion pairs do not hold: a turn at FreeMotion::rotation about an axis through FreeMotion::about, with a slide of about at FreeMotion::translation.
Icp
How icp and symmetry_plane register.
Registration
What icp found.
SymmetryFit
What symmetry_plane found.

Enums§

Starts
Where icp starts from.

Functions§

absolute_orientation
The rigid transform carrying the first point of each pair onto the second with the least weighted sum of squared distances, in closed form.
icp
Register source onto the mesh target was built over: the rigid transform carrying the points onto it, from each of Icp::starts, the best scored. See the module for the rounds, the score and the free motions.
symmetry_plane
The plane the points are the mirror image of the mesh target was built over in, from each of seeds, the best scored.