[csswg-drafts] [css-transforms] Coordinate inversion for 3D matrix decomposition (#3711)

kevers-google has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-transforms] Coordinate inversion for 3D matrix decomposition ==
Link to spec: https://drafts.csswg.org/css-transforms-2/#decomposing-a-3d-matrix

In cases where the determinant is negative, the spec proposes inverting all scales and matrix elements. Though this leads to a valid decomposition it means than any 3D decomposition of a 2D transformation matrix with a scale inversion results in a decomposition that cannot be expressed as a sequence of 2D transform operations.

Consider the 3D decomposition of matrix(-1, 0, 0, 1, 0, 0).

This is equivalent to scaleX(-1); however, following the recipe, the 3D decomposition is equivalent to scale3d(1, -1, -1) rotateX(180deg).

3D decomposition of a 2D transformation matrix should yield comparable results to the 2D algorithm outlined here: https://drafts.csswg.org/css-transforms/#decomposing-a-2d-matrix.  This can largely be addressed by using a similar strategy to the 2D case and only invert 1 scale when the determinant is negative.  The 2D spec proposes flipping the axis with the minimum unit vector dot product.  This approach should work for the 3D case as well.



Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3711 using your GitHub account

Received on Wednesday, 6 March 2019 18:30:33 UTC