#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 each row of `from` (homogeneous /// 4-vector) to the corresponding row of `to`: `R · fromᵀ = toᵀ`. /// Computed as `R = toᵀ · (fromᵀ)⁻¹`. Same as Java /// `MatrixUtility.makeMappingMatrix()`. inline Eigen::Matrix4d makeMappingMatrix(const Eigen::Matrix4d& from, const Eigen::Matrix4d& to) { return to.transpose() * from.transpose().inverse(); } } // namespace conformallab