#pragma once // 4x4 mapping matrix from corresponding point pairs. // Ported from de.varylab.discreteconformal.math.MatrixUtility (Java). #include namespace conformallab { // Find the 4×4 matrix R that maps source points to target points. // Each row of `from` / `to` is a homogeneous 4-vector (one point per row). // Post-condition: R * from.row(i).T == to.row(i).T for all i. // // Implementation: R = to^T * (from^T)^{-1} // Corresponds to Java MatrixUtility.makeMappingMatrix(). inline Eigen::Matrix4d makeMappingMatrix(const Eigen::Matrix4d& from, const Eigen::Matrix4d& to) { return to.transpose() * from.transpose().inverse(); } } // namespace conformallab