Some checks failed
C++ Tests / test-fast (push) Has started running
C++ Tests / test-cgal (push) Has been cancelled
API Docs / doc-build (push) Has been cancelled
Doxygen → Codeberg Pages / publish (push) Has been cancelled
Markdown link check / check (push) Has been cancelled
Mirror to Codeberg / mirror (push) Has been cancelled
23 lines
736 B
C++
23 lines
736 B
C++
#pragma once
|
||
// Copyright (c) 2024-2026 Tarik Moussa.
|
||
// SPDX-License-Identifier: MIT
|
||
|
||
|
||
// 4x4 mapping matrix from corresponding point pairs.
|
||
// Ported from de.varylab.discreteconformal.math.MatrixUtility (Java).
|
||
|
||
#include <Eigen/Dense>
|
||
|
||
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
|