Re: [eigen] Rotations and unit vectors

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


On 07.05.2013 17:51, Andreas Keil wrote:
I therefore vote for using a threshold like sqrt(eps) or even smaller in
a debug assert. I would argue that this is the least Eigen should do to
ensure that its AngleAxis and Quaternion classes represent what they are
named after.

W.r.t the threshold I vote for not being too strict, to avoid breaking code, where low precision is sufficient.

W.r.t. Quaternion there is the problem that it is only somehow intended to be a unit quaternion but never explicitly named so.
There are also users who like to use non-unit Quaternions:
http://eigen.tuxfamily.org/bz/show_bug.cgi?id=560

If it actually was a unit quaternion, then normalize(), normalized(), norm() and squaredNorm() could be essentially NOPs/accessors/const-expressions, and inverse() would be just an alias for conjugate().

However, functions such as toRotationMatrix() or q * v give undefined (or unintended) behavior for non-unit quaternions).

I'd like to vote again for adding a new class UnitQuaternion which does run-time checks for unity (and exploits all reasonable optimizations) and either deprecate the current Quaternion class to introduce a new class GeneralQuaternion, which works as suggested in bug 560, or let the current Quaternion class behave like a general quaternion. That also means that q*v shall return (q*[0;v]*q.conjugate()).vec() or should not be implemented at all.

Unfortunately, I think that deprecating/deleting/redefining Quaternion is a rather heavy step and at least deleting/redefining must wait until Eigen 4.0, to ensure API compatibility.



Christoph


--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/