cgmath
cgmath copied to clipboard
3x4 and 4x3 matrix support
Would 3x4 and 4x3 matrix support (including pseudo invert between them) make sense as an addition to this library? I'm working on a raw loading library that uses those sizes to deal with 4 color images being converted into 3 color ones:
https://github.com/pedrocr/rawloader/blob/4ba0a7a992f6d6c9384f68cf25f81c6ee71621b7/src/imageops/colorspaces.rs
It would be nice if I could move to using a library instead of doing these things by hand.
This would be super cool. Not sure how best to do it though. The traits have been designed in such a way as to allow that though.
The pseudo-inverse code is half there (only does one direction) and the multiplication code would be easy. What else would be needed for proper support for this?
Not sure! Feel free to chat to me on Gitter: https://gitter.im/brendanzab/cgmath
One potential option would be to make matrices generic over InnerSpace
, so that the number in the Matrix
type's name represents the number of rows and the number of columns is represented by the vector's dimensions. That would make a 4x3 matrix Matrix4<Vector3<_>>
, and a 3x4 matrix Matrix3<Vector4<_>>
. The current, square matrices would then be typedefs of those types.