Subject: Re: [boost] Review Request: QVM (generic Quaternion, Vector and Matrix operations library)
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2015-05-07 09:48:08


David Bellot wrote:
>> Me: Just #include this and use types called floatvec2 and floatmat2x2
>> and + and * just work.
>>
> ​my cosmetic and artistic opinion about that:
> ​
> ​with ublas, you can do that:​
>
> ​#include <boost/
> ​numeric/ublas/matrix.hpp>
>
> // this is not needed but it's useful to have them
> ​#include <boost/
> ​numeric/ublas/io.hpp>
> ​#include <boost/
> ​numeric/ublas/assignment.hpp>
>
> ​int main()
> {
> fixed_matrix<double,3,3> m1;
>
> m1 <<= 1,2,3
> 4,5,6,
> 7,8,9;
>
> cout << m1 << endl;
> }
>
> And personally, I find fixed_matrix<double,3,3> to be easier to remember
> and more explicit to use than floatvec2 or dblmat2x2 or whatever else. And
> I don't have to look into the doc, if I can't remember if the matrix name
> was DblMat2x2 or double_mat2_2... or Matrix2D ? (no, it's not the same
> library).

QVM defines ready-to-use types as well:
http://www.revergestudios.com/boost-qvm/quaternion_vector_and_matrix_types_reference.html

qvm::vec<double, 3> v;
qvm::mat<double, 3, 3> m;

As for the <<= syntactic sugar, I'd rather consider adding a support for
C++11 std::initializer_list and/or variadic templates (if they were
supported by the compiler):

m { 1,2,3
     4,5,6
     7,8,9 };

That said, the user could implement such type by himself.

He could also adapt fixed_matrix to the QVM matrix Concept and be able
to e.g. calculate the transformation matrix.
Of course assuming that both libraries could work well with each other.

Regards,
Adam