Core Alignment Pipeline (SVD normal)

Blue = Flaking scars  |  Red arrow = SVD normal  |  Orange arrow = PCA main axis (X)  |  Gray plane = SVD best-fit plane

Compute unit direction vectors from scar endpoints.
SVD decomposition extracts the 3rd right singular vector
as the best-fit plane normal of the scar pattern.

Construct rotation matrix R₁ via Rodrigues' formula.
Rotate all coordinates so the SVD normal aligns with Z-axis.
The best-fit plane now lies on the XY plane.

Compute the centroid of all scar endpoints in rotated space.
Subtract centroid from all coordinates to center the cloud at origin.
Removes positional bias between specimens.

SVD on XY projections of direction vectors finds the main axis.
Rotation matrix R₂ aligns this axis to the X-axis.
All specimens now share a standard orientation for comparison.