Re: [eigen] Re: Rigid transformations in eigen: use of dual quaternions |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] Re: Rigid transformations in eigen: use of dual quaternions
- From: Benoit Jacob <jacob.benoit.1@xxxxxxxxx>
- Date: Sat, 12 Sep 2009 13:10:21 -0400
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=JfpRHBoRBGc552SP8i62BcSuf393cCF5tJn89jDGEFI=; b=bx1Jan2baHMQVy+DK12vB9uH7j18x0UAfAA98UucCS0/eyaZJEIxeuiHOt80KaNomV aUsarfiw7RRAqVqNnOpk7E4xZnHUJqnqpvfU18UQNbPn9NmLxtWLF7ckOylqeAYE+dWu cWnhva4jrlNnIbEG4ifMKbMyBzlDGlnx6YO1Y=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=qPr4JgbD3bLZFlQiJS+DHSb8Ah2s4EvTXOSBo8hlWRXV7HQ4Bvz2OVZu3Zrq+HXXTu QGn0sz+vpbDitfCGbGjO5fzO5cXb+E2d5oSm3txSPzV84MYgn2UcxpTC6YTzI0S7rQO+ 6IgsRSctBqNM12FfTwJhlotGk3avHAMkjUXtw=
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;
t().block(....)
Here it's just a shortcut for matrix().
Is that OK ?
Benoit