From 043442e21b882b778e43f8fcdd570ec9fea4adf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20S=C3=A1nchez?= Date: Tue, 30 Jan 2024 06:37:33 +0000 Subject: [PATCH] Fix preshear transformation. --- Eigen/src/Geometry/Transform.h | 3 ++- test/geo_transformations.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index 077441da8..fd3fc58f4 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -943,7 +943,8 @@ EIGEN_DEVICE_FUNC Transform& Transform(0, 0) = LinearMatrixType(1, sx, sy, 1) * m_matrix.template block(0, 0); + m_matrix.template block(0, 0) = + LinearMatrixType({{1, sy}, {sx, 1}}) * m_matrix.template block(0, 0); return *this; } diff --git a/test/geo_transformations.cpp b/test/geo_transformations.cpp index 2fddf55cc..a9eb87e25 100644 --- a/test/geo_transformations.cpp +++ b/test/geo_transformations.cpp @@ -273,6 +273,12 @@ void transformations() { .matrix() .isIdentity(test_precision())); + t20.setIdentity(); + t20.shear(Scalar(2), Scalar(3)); + Transform2 t23 = t20 * t21; + t21.preshear(Scalar(2), Scalar(3)); + VERIFY_IS_APPROX(t21, t23); + // Transform - new API // 3D t0.setIdentity();