Re: [eigen] Rotations and unit vectors

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


Hi,

I understand your frustation. However I see three issues about adding
such asserts:

1 - performance drop without -DNDEBUG (probably acceptable)
2 - the axis vector can be changed with the .axis() method. Therefore
we should assert for unit vectors anytime it is assumed to be so. This
concerns many more functions.
3 - Which tolerance? Shall we strictly enforce that
axis.normalized()==axis? shall we tolerate some epsilon??

Whereas 1), and 2) are not critical, I'm worried about number 3) for
which I easily see false positives showing up or true negative not
being detected...

gael


On Sun, May 5, 2013 at 11:01 AM, Hauke Heibel <hauke.heibel@xxxxxxxxx> wrote:
> Hi,
>
> I've just spent some considerable time debugging a unit test of mine and
> started seriously questioning myself until I found out that I created a
> random transformation via
>
> Eigen::AngleAxis<double> rotation(random_angle, Vector3d::Random());
>
> It turned out that this rotation is not norm preserving - well my fault
> since I initialized it the wrong way. ;)
>
> I am just wondering whether we should add run-time asserts to classes which
> require unit vectors as inputs. If I remember correctly this also applies to
> the Quaternion class.
>
> So far, I would add this assert to
>
> a) AngleAxis<double>(const Scalar& angle, const MatrixBase<Derived>& axis)
> b) Quaternion(const Scalar& w, const Scalar& x, const Scalar& y, const
> Scalar& z)
>
> Maybe even AngleAxis(const MatrixBase<Derived>& m) deserves a test. I am not
> sure what happens, when anything but a rotation matrix is passed to the
> class.
>
> Regards,
> Hauke



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