Re: [eigen] Euler-angles and partial reductions API design
• To: eigen@xxxxxxxxxxxxxxxxxxx
• Subject: Re: [eigen] Euler-angles and partial reductions API design
• From: "Gael Guennebaud" <gael.guennebaud@xxxxxxxxx>
• Date: Fri, 18 Jul 2008 02:00:15 +0200
• Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=THBR2w67Iu0mejA7DbNNv/CbSdv+ztjG0+g2AnE1YNTUxQSnKObjG109HcD1SndHhs 13u0nN+ofJg/0IsNNYDnH5MpN/aVLPWinxCIS9UHt2bkX8v++rN94YmPvg1LwgkWGZOn pyhHTSW1OzH0LSGYCO8R6rk2bWYjXGWdkL5Ck=

```I agree Euler angles are somewhat useless (and might even be dangerous
for the beginners because of their apparent simplicity). Nevertheless
they remain really conveniant to specify/initialize the orientation of
an object as a concatenation of elementary rotations. In this context
I think it very important to be able to specify the order, otherwise
we completely miss the convenience point. So if we agree this is the
only use case, then we can drop the EulerAngles class, and provide and
alternative, more explicit and generic API. Actually currently it is
possible to mimic the proposed:

Matrix3f m = EulerAngles<float,XYZ>(1,2,3);

by

Matrix3f m2 = AngleAxis<float>(1, Vector3f(1,0,0))
* AngleAxis<float>(2, Vector3f(0,1,0))
* AngleAxis<float>(3, Vector3f(0,0,1));

that is a bit heavy (though quite often 1 or 2 elementary rotations
are enough to reach the desired orientation).
So what we could do is to make easier the creation of elementary
rotations using either:

* static functions of Matrix:
Matrix3f m = Matrix3f::RotX(1) * Matrix3f::RotY(2) * Matrix3f::RotZ(3);

* super short classes inheriting Matrix<Scalar,3,3> (or global functions)
Matrix3f m = RotX<float>(1) * RotY<float>(2) * RotZ<float>(3);

* the same with typedef  (or alias):
Matrix3f m = RotXf(1) * RotYf(2) * RotZf(3);

I have to say I like this last option, though someones might find the
names not explicit enough ? it might also be confusing with the "rot"
vector operator (curl) ?

gael.

On Thu, Jul 17, 2008 at 8:00 PM, Christian Mayer <mail@xxxxxxxxxxxxxxxxx> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
>
> Gael Guennebaud schrieb:
>
>> Let's start with the EulerAngles class of the geometry module. [...]
>
> Apart from the fact that EulerAngles are quite useless for real work I
> can understand that beginners usually want them to get a quick start...
>
> Generally it's best to keep the libaray as small and generic as possible.
>
> So I'd offer only one function that generates the rotation matrix. This
> function should have a fixed order (that's identical to OpenGL -
> although I didn't find a gl, glu or glut function that uses euler
> angles...).
>
> If the user wants a left or a right multiplication is totally up to him,
> so the library should try to be smarter :)
>
> CU,
> Christian
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFIf4itoWM1JLkHou0RCD8LAJ0fLw/XfnBezR5i43q4Izln9Hy0VgCfZGDr
> dXdk5TfQ8eSvSDRjtxzFuWU=
> =JZq/
> -----END PGP SIGNATURE-----
>
>
>

```

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