Support matrix multiplication of homogeneous row vectors

This commit is contained in:
Sergiu Deitsch
2025-09-23 16:56:28 +02:00
committed by Rasmus Munk Larsen
parent 2d170aea11
commit 4df215785b
3 changed files with 20 additions and 2 deletions

View File

@@ -112,6 +112,18 @@ void homogeneous(void) {
VERIFY_IS_APPROX((t2.template triangularView<Lower>() * v0.homogeneous()).eval(),
(t2.template triangularView<Lower>() * hv0));
{
const MatrixType points = MatrixType::Random();
const VectorType center = VectorType::Random();
const auto pts3 = points.rowwise() - center.transpose();
const auto pts_xy1 = pts3.template leftCols<Size - 1>().rowwise().homogeneous();
const auto pts_xy2 = pts3.template topRows<Size - 1>().colwise().homogeneous();
VERIFY_IS_APPROX(pts_xy1.transpose() * pts_xy1, pts_xy1.transpose() * pts_xy1.eval());
VERIFY_IS_APPROX(pts_xy2 * pts_xy2.transpose(), pts_xy2.eval() * pts_xy2.transpose());
}
}
EIGEN_DECLARE_TEST(geo_homogeneous) {