w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.44k stars 657 forks source link

[css-transforms] [geometry-1] [webxr] Extract matrix fundamentals into a separate spec #4076

Open Manishearth opened 5 years ago

Manishearth commented 5 years ago

Various specs use the concept of matrices. CSS transforms has the most in-depth coverage, with a whole section on the mathematical description of transform functions.

The geometry spec also uses matrices for DOMMatrix, and uses concepts like multiplication. Furthermore, it refers to the parsing algorithm in css-transforms.

WebXR also relies on matrices and refers to concepts like "quaternion that describes the rotation indicated by the top left 3x3 sub-matrix". There was a time when it relied on matrix decomposition as well. We've had a bunch of stumbles over premultiply/postmultiply in the past, while a lot of the ambiguity has been cleaned up it would have been nice to outsource the problem to a unified spec.

I'm sure there are other specs like this.

It would be nice if we had a single spec, much like the infra spec that defined all matrix operations in one place, including things like conventions used (I think all w3c specs use column-vector matrices). All other specs can simply refer to these for the actual algorithm.

cc @zcorpan for the geometry spec, @klausw for matrices in the WebXR spec

I'm not sure if this is the right place for this, but the transforms spec is the one with the most matrix stuff, and it covers a lot of the definitions more thoroughly than others.

zcorpan commented 5 years ago

I think this would make sense. Geometry mostly refers to css-transforms, so having a common spec should work for those two specs. I'm not familiar with the details of WebXR, but it seems surprising if its matrix calculations should be somehow different.

Manishearth commented 5 years ago

I might draft something like this at some point.

smfr commented 5 years ago

Sounds like a good idea!