Re: [eigen] Rotations and unit vectors |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen <eigen@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: [eigen] Rotations and unit vectors
- From: Gael Guennebaud <gael.guennebaud@xxxxxxxxx>
- Date: Tue, 7 May 2013 12:07:46 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=vRQFLXku94QJtFTohPZRe3HGwyE3NJ5RdROwTVpMdZM=; b=uBgZhxkkZSsu+YRXfCdwwP0R++3VK9OxX6yv0C6eck2yiFrFWkizME7XwRS+XkJFK6 7D2L466+itSHNkVmGL4TG0W8K58Nn2X1nWOrZsMhTcTx1AJ4K8yJnMBQhAoGGSC2yLML ncbMelf9uBMqOooVkyARB7Zwd/42b8aiOnyi4+gTokYNwo6PgURHMXHs/47g6VVFqOXm IVZY+jDwFBBIlKqjoRMC6rt8prLAdqv45rzfiAHx600ybXMjX2FTAmjvmZmDdBGx/PWb UUHur9ZMl4QdqNiZM1j16juYA+3lttRgVN2GbTT4i18UAwrd8VI60vYTBdKRLkjLMRI2 jZFQ==
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