ewoksndreg.transformation.lstsq.calc_rigid#
- ewoksndreg.transformation.lstsq.calc_rigid(from_coord, to_coord)[source]#
Coordinate array shape is (ndim, ncoord).
Find the proper-rigid transformation between two sets of coordinates by solving this system of equations (https://igl.ethz.ch/projects/ARAP/svd_rot.pdf):
\[ \begin{align}\begin{aligned}\begin{split}\begin{align*} X_c &= (X-Cen(X)) \\ Y_c &= (Y-Cen(Y)) \\ C.X + T &= X' \\ T &= Cen(X') - C.Cen(X) \end{align*}\end{split}\\\begin{split}\begin{align*} C.X_c &= Y_c \\ H &= X_c . Y_c^T \\ H &= U . S . V^T \\ C &= V.U^T \\ \end{align*}\end{split}\\\begin{split}\begin{align*} C.X + T &= X' \\ T &= Cen(X') - C.Cen(X) \end{align*}\end{split}\end{aligned}\end{align} \]where C is found with singular value decomposition. The resulting transformation matrix is
\[\begin{split}\begin{equation*} \begin{bmatrix} C & T\\ 0 & 1\\ \end{bmatrix} \end{equation*}\end{split}\]- Parameters:
from_coord (
Sequence
[ndarray
])to_coord (
Sequence
[ndarray
])
- Return type:
ndarray