centerView patch

Hi guys,

I’m one of the developer of Eigen2 and by some hazard I looked at your
piece of code implementing the animated “centerView” feature. It is
currently based on the interpolation of Euler angles which is a very
bad practice. For instance, currently the animation looks sometimes
pretty weird because it does not take the shortest path. Actually,
whenever you want to interpolate between rotations the only reliable
tool is called quaternion. So here you go for a patch doing the same
but with quaternions. As you can see, in addition to be simpler it
also leads to a correct behavior. Hope you like it !

Another thing: I recently added coefficient accessors to Eigen::Transform, so:

Transform t;
t.matrix()(i,j)

can now be written:

t.m(i,j)

cheers,
Gael.

Thanks, committed in r1574. Indeed the slerp is definitely the right approach
here.

about the t.matrix()(i,j), i didn’t know we also had t(i,j) in eigen2, that’s
great, however I grepped for it and it seems that the occurences that your
patch replaces were the last ones.

Cheers,
Benoit

On Sunday 07 September 2008 21:30:53 Gael Guennebaud wrote:

Hi guys,

I’m one of the developer of Eigen2 and by some hazard I looked at your
piece of code implementing the animated “centerView” feature. It is
currently based on the interpolation of Euler angles which is a very
bad practice. For instance, currently the animation looks sometimes
pretty weird because it does not take the shortest path. Actually,
whenever you want to interpolate between rotations the only reliable
tool is called quaternion. So here you go for a patch doing the same
but with quaternions. As you can see, in addition to be simpler it
also leads to a correct behavior. Hope you like it !

Another thing: I recently added coefficient accessors to Eigen::Transform,
so:

Transform t;
t.matrix()(i,j)

can now be written:

t.m(i,j)

cheers,
Gael.