glam-rs icon indicating copy to clipboard operation
glam-rs copied to clipboard

Add Mat/Affine minor method

Open bitshifter opened this issue 3 years ago • 0 comments

Discussed in https://github.com/bitshifter/glam-rs/discussions/323

Originally posted by Demiu August 15, 2022 Hello, while working with 2D/3D transformation using matrices I felt a certain transformation was missing. There is no ergonomic way to turn a matrix for 3D transformation (Mat4) into a matrix for 2D transformation (Mat3) preserving the translation; for example cut off Z off a Mat4, so remove 3rd column and 3rd row. Same thing is missing from the Affine types.

I think it would be a good convenience function

Add a minor method to support this use case.

One catch is supporting both Mat3 and Mat3A. For this case from_minor(Mat4) could be used, but that doesn't work so well for the Mat2 case, also, minor as a method feels nicer though.

bitshifter avatar Aug 17 '22 03:08 bitshifter