Loading
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?
transform_construct_from_matrix<..., HDim, HDim>callstransform_make_affineforAffine/Isometry, matching the Dim×Dim and Dim×(Dim+1) specializations and the mode-converting constructor.- The Doxygen comments of
Transform(const EigenBase&)andoperator=(const EigenBase&)state that the last row is set forAffine/Isometry, andCHANGELOG.mdlists the fix. geo_transformationsgainstransform_from_full_matrix, which checks both the constructor andoperator=forAffine,Isometry,AffineCompactandProjective, 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
Matrix4dand fills the linear part afterwards. If you'd prefer aneigen_assertin addition, I'm happy to add it. Isometryorthogonality 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 20geo_*tests, GCC, Release, Linux x86-64.git clang-formatreports no changes on the diff.
Edited by Amirishetty Sai Vignesh