Geometry: Reset last row when building Affine/Isometry Transform from matrix

Constructing or assigning an Affine or Isometry Transform from a full (Dim+1)×(Dim+1) matrix now resets the last row to [0 ... 0 1], as every other construction path already does. Previously the matrix was copied verbatim, so the transform could silently violate its Mode. Projective keeps the row as given and AffineCompact is unchanged.

Reference issue

Part of #2715 (closed) (reported by @bassofil). The issue's repro, an Isometry whose linear part is not orthogonal, is not addressed here.

What does this implement/fix?

  1. transform_construct_from_matrix<..., HDim, HDim> calls transform_make_affine for Affine/Isometry, matching the Dim×Dim and Dim×(Dim+1) specializations and the mode-converting constructor.
  2. The Doxygen comments of Transform(const EigenBase&) and operator=(const EigenBase&) state that the last row is set for Affine/Isometry, and CHANGELOG.md lists the fix.
  3. geo_transformations gains transform_from_full_matrix, which checks both the constructor and operator= for Affine, Isometry, AffineCompact and Projective, column- and row-major. It fails at the parent commit.

Additional information

  • This corrects the last row rather than asserting on it. An assert would break existing code that builds a transform from, e.g., an uninitialized Matrix4d and fills the linear part afterwards. If you'd prefer an eigen_assert in addition, I'm happy to add it.
  • Isometry orthogonality of the linear part is still not checked, as with the Dim×Dim path.
  • Validation: geo_transformations_1 (fails without the fix, passes with it) and all 20 geo_* tests, GCC, Release, Linux x86-64. git clang-format reports no changes on the diff.
Edited by Amirishetty Sai Vignesh

Merge request reports

Loading
Loading