rigid_body_motion.best_fit_transform¶
- rigid_body_motion.best_fit_transform(v1, v2, dim=None, axis=None)[source]¶
Least-squares best-fit transform between two arrays of vectors.
Finds the rotation r and the translation t that minimize:
\[|| v_2 - (rot(r, v_1) + t) ||\]- Parameters
- v1: array_like, shape (…, 3, …)
The first array of vectors.
- v2: array_like, shape (…, 3, …)
The second array of vectors.
- dim: str, optional
If the first array is a DataArray, the name of the dimension representing the spatial coordinates of the vectors.
- axis: int, optional
The axis of the arrays representing the spatial coordinates of the vectors. Defaults to the last axis of the arrays.
- Returns
- translation: array_like, shape (3,)
Translation of transform.
- rotation: array_like, shape (4,)
Rotation of transform.
See also
References
Adapted from https://github.com/ClayFlannigan/icp