question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`Matrix4.inverseTransformation`: misleading documentation

See original GitHub issue

https://github.com/CesiumGS/cesium/blob/80ceefef2ee8e2f3236c38b8f7fb639caa38a3d8/Source/Core/Matrix4.js#L2589-L2592

I don’t know who is defining “affine transformation” to be a composition of a rotation and a translation. Every definition I’ve found gives an affine transformation as an arbitrary (invertible) linear transformation followed by a translation.

However, inverseTransformation returns subtly wrong results when, for instance, a non-uniform scale component is introduced.

The situation regarding this function is confusing, and could be improved:

  • The documentation of inverseTransformation (and the cross-reference in the documentation of inverse) should be reworded to avoid using the term “affine transformation”.
  • Moreover, the function name is misleading. It does not invert all transformations. It should be called inverseRotationTranslation.

This issue was a real time-waster for me; hopefully the situation can be improved for future users.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
j9liucommented, Jun 9, 2021

@atlight @ebogo1 Would it make more sense if the documentation for inverseTransformation read something as follows?

* Computes the inverse of the provided matrix assuming it is
* a composition of a rotation and a translation,
* where the upper left 3x3 elements are a rotation matrix,
* and the upper three elements in the fourth column are the translation.
* The bottom row is assumed to be [0, 0, 0, 1].

The documentation for inverse can be adjusted similarly:

* Computes the inverse of the provided matrix using Cramers Rule.
* If the determinant is zero, the matrix can not be inverted, and an exception is thrown.
* If the matrix is a composition of a rotation and a translation, it is more efficient
* to invert it with {@link Matrix4.inverseTransformation}.

As for the alternative to inverseTransformation, maybe @ebogo1 let me know what you or others think of in the near future and I can work on replacing the name?

0reactions
j9liucommented, Jun 10, 2021

Oh! Then perhaps we can change the wording of the documentation to say “Computes the inverse of the provided matrix assuming it is a rigid transformation.” However, it wouldn’t necessarily be true that “the upper left 3x3 elements are a rotation matrix,” right?We would have to reword it where “the upper left 3x3 elements are a rotation or reflection matrix,” or something like that?

Read more comments on GitHub >

github_iconTop Results From Across the Web

LKJ inverse transform for correlation matrices (incorrect ...
Hello, I think there is an inconsistency/error in the Stan reference manual for the LKJ inverse transform for correlation matrices.
Read more >
3.5: Matrix Inverses - Mathematics LibreTexts
Learn about invertible transformations, and understand the relationship between invertible matrices and invertible transformations. Recipes: ...
Read more >
2.4 Matrix Inverses - Math at Emory
This geometric view of the inverse of a linear transformation provides a new way to find the inverse of a matrix A. More...
Read more >
Custom layers: inverse transformation matrix #9773 - GitHub
The matrix passed to custom layer functions can be used for transforming from Mercator to clip space coordinates. Is it possible to perform...
Read more >
XRRigidTransform.inverse - Web APIs - MDN Web Docs
This outline of a renderer's core code shows how the pose's view gets represented by taking its transform's inverse's matrix as the model ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found