Re: [eigen] Mapping array of scalars into quaternions

[ Thread Index | Date Index | More Archives ]


typedef Quaternion<MyScalar> MyQuat;

and not:

typedef Quaternion<Matrix<MyScalar,4,1> > MyQuat;

right ?

Yes, I want to keep the former Quaternion notation.

then the first template argument of Quaternion must be the scalar type. But if we prefer we can also introduce a QuaternionBase and a QuaternionWrapper classes like we did for DiagonalMatrix. Of course this is more work, but perhaps that's a good idea to harmonize that over Eigen.

Besides quaternions, i want to have two distinct members of Lie algebras which represent angular velocities of a rigid body or torques applied on a rigid body which could be represented by vectors of 3 elements. I need to have a Lie bracket [A,B] = AB - BA which had a specific implementation for thoses vectors. Moreover, I need a map mecanism to interface Eigen with an another library.

So, I have severals options :

1) Add this function in MatrixBase (through the plugin mecanism) whith some asserts to check that the function is called only on vectors.

2) Do something similar to the actual Quaternion class with (a proper version of) my patch.

3) Inherit a new class (FooBase) from MatrixBase and introduce two other classes Foo and FooWrapper.

Since, these new objects are vectors (like quaternions in fact), the 1st and 2nd options would benefit from the map mecanism of matrices.

The 3rd option looks like what we actually have in our own libraries that could reduce my work to adapt our algorithms to Eigen.

So, I wonder which option to choose in regards with your opinion on Wrapper and map mecanisms.

Mathieu Gautier

Mail converted by MHonArc 2.6.19+