Version 0.60.0

align_points::align

Creates a transformation that matches one set of points with another one.

Signatures

  •   align( vector& vecA[], vector& vecB[] )
  •   align( vector& vecA[], vector originA, vector& vecB[], vector originB )

Details

The function returns a transformation that moves one set of 3d space points A onto another equally sized set of points B. The transformation creates the best possible match in the sense that the sum of distances squared between all pairs of points of A and B is minimized. This can be compared to a situation where elastic strings are attached to each pair of points that pull the rigid set A onto B (see sketches).

Remark

The transformation returned by this function does not scale nor does it alter angles. This means, it is a combination of a translation and a rotation (i.e. a rigid transformation).

The first constructor returns the optimal rigid transformation for achieving the best match between the point sets.

The figure depics how the movement of three points of A can be understood for the first constructor. The left image display virtual "rubber bands" (green lines) that are pairwise attached to the points of A and B. These bands pull A into the closest position.

The second constructor moves an origin point given for set A onto the corresponding origin point of B by applying a translation. This guarantees that the origins of the two sets are coincident. Then, a rotation of A around the common origin point is applied, that moves points of A into positions closest to B. The position of A thus found is not necessarily as optimal as the position resulting from the first constructor, but it ensures the coincidence of the origin points. The combinatory transformation of the translation and rotation is returned.

The second constructor combines a translation of origin of A onto the origin of B (left image) with a rotation around the origin (center image) onto the final optimal position (right image).

Return value

An affine transformation that moves point set A as close to point set B as possible .

Parameters

vecA

Array of vectors defining the points of set A. This array should have the same length as vecB.

vecB

Array of vectors defining the points of set B. This array should have the same length as vecA.

originA

A space point defining an origin point associated with set A.

originB

A space point defining an origin point associated with set B.

🗙

Search results for