How this calculation works
Orthogonal Procrustes alignment finds the rotation, or optionally reflection, that best matches two corresponding point sets. Pairing is supplied by row order rather than inferred. With centering enabled, the page removes both centroids before fitting orientation and then recovers a translation. Without centering, the origin is fixed and translation is zero. No scale factor is fitted, so distances within the source shape remain unchanged by the transformation.
Minimize Σ|R·Aᵢ + t − Bᵢ|² with RᵀR = I; determinant +1 for rotations, ±1 when reflection is allowed.A worked example
Source points (0,0), (1,0), (0,1) match targets (2,3), (2,4), (1,3) under a 90° counterclockwise rotation followed by translation (2,3). The rotation matrix is [[0,−1],[1,0]] and its determinant is +1. Every fitted point matches its target, so the RMS residual is zero apart from floating-point roundoff.
Good to know
Use two through 100 matched planar rows in each list, with the same coordinate grid and range. This page does not find point correspondences, fit a dilation, perform a general affine transformation or remove outliers. Some degenerate or collinear configurations permit multiple equally good transforms, which are identified. Residuals describe fit to the supplied observations and are not uncertainty estimates.
Reference: SciPy — orthogonal Procrustes problem and transformation scope (opens in a new tab) ↗
Translation, rotation and scale are separate choices
In the default example, source and target triangles have the same side lengths, so rotation and translation can align them exactly. If every target coordinate were also dilated by two relative to its centroid, a pure orthogonal fit would leave residual error. An orthogonal matrix preserves lengths; allowing it to absorb scale would solve a different optimization problem. The page therefore reports the matrix, translation and residuals explicitly.
With translation enabled, the difference between the transformed source centroid and the target centroid determines the fitted translation after orientation is selected. Keeping the origin fixed removes that freedom and can change the best-fit angle as well as the residual. The chosen convention is shown in the steps. It should match whether your coordinate origins represent real fixed landmarks or arbitrary drawing positions.
The matrix determinant calculator can verify whether the fitted orthogonal matrix has determinant +1 for a rotation or −1 for a reflected map.
A reflected fit must not be presented as an ordinary rotation
Proper rotations have determinant +1. Mirror transformations have determinant −1 and reverse orientation. When reflections are allowed, the solver compares the best scores from both transformation classes. If a mirror image is required to match the data, that determinant and reflection status remain visible. Its angle-like matrix parameter is not labeled as an ordinary rotation angle; it represents twice the reflection-axis angle.
Rows must correspond to the same physical or mathematical points in both lists. Swapping two target rows changes the problem rather than merely changing display order. The residual table shows each paired target and fitted point so a mistaken correspondence can be spotted. The RMS metric is the square root of the mean squared point distance, not the average point distance. A known-angle rotation calculator applies a supplied transform; this page estimates the best transform from matched observations.
A few questions, answered
Does allowing reflection always improve the fit?
It can improve or leave the optimum unchanged, because proper rotations remain available. The result reports whether the selected optimum actually uses reflection.
Does a zero residual prove my point matching is correct?
No. It only shows that the supplied paired coordinates admit the selected transformation. Correct real-world correspondence is an input assumption.