Closed wojdyr closed 7 years ago
It's been discussed in various meatspace conversations over the past few years. Many projects using linalg.h
tend to have a file that looks like this: https://github.com/ddiakopoulos/sandbox/blob/master/linalg_util.hpp
Thanks for your interest in linalg!
The matrix factory functions definitely need a little love. I'd always intended for something a little more flexible, which could support transformations in both 2D and 3D and with or without homogeneous coordinates. The extra enums for the different styles of projection matrices are also pretty bolted-on and deserve a little cleanup.
The lack of an identity function is a pretty silly omission, it comes down to the fact that most functions in linalg dependent on their arguments for both template type deduction (float vs double, matrix size, etc.) as well as argument dependent lookup (so you don't have to explicitly type linalg:: in front of everything). I think I'll introduce a linalg::identity
constant, similar to how std::nullopt
or the builtin nullptr
works, which can be used to construct or assign to any square matrix of any underlying type.
Thanks a lot!
I see that the design of linalg is rather minimalistic and this may be seen as a feature creep. So I don't mind if you just close this issue. That said, a function to generate an identity matrix is often handy, even if it's trivial to write it manually.