Re: [eigen] Re: Rigid transformations in eigen: use of dual quaternions

[ Thread Index | Date Index | More Archives ]

2009/9/12 Rohit Garg <rpg.314@xxxxxxxxx>:
> On Sat, Sep 12, 2009 at 8:38 PM, Benoit Jacob <jacob.benoit.1@xxxxxxxxx> wrote:
>> Just one quick note:
>> if you need efficient operator + * etc... NOW, you can always do this
>> on the underlying vector of coefficients:
>> Quaternionf result = Quaternionf( s1 * q1.coeffs() + s2 * q2.coeffs() );
>> In this way, you get all the power of expression templates. The only
>> drawback is how it's heavy to have to write coeffs() and the
>> conversion constructor.
> As long as they are efficient, I can write them inside my dual
> quaternion class once and for all.

Yes, that's efficient.

I just noticed that Quaternion has an operator= taking a MatrixBase,
so you can also directly do:

result = s1 * q1.coeffs() + s2 * q2.coeffs();

sorry for the noise.

Another consideration: it's of course a bit heavy to have to write
coeffs(). Here's a proposal: implement operator()(void) as a shortcut
for coeffs (a separate question then is whether to remove coeffs();
i'm OK for that).

So you could do:

result = s1 * q1() + s2 * q2();

I know that it's always scary to introduce non-self-explanatory
operator overloading. Here i was thinking that that could be made
homogeneous across Eigen, so that the user would have to learn that
trick once and for all. The rule would be: whenever an object is a
wrapper around a Matrix, and there are real use cases for addressing
the matrix, the underlying Matrix can be accessed by operator()(void).
So that would also apply to class Transform:
Transform t;
Here it's just a shortcut for matrix().

Is that OK ?


Mail converted by MHonArc 2.6.19+