Octothorpe
Octothorpe

Reputation: 175

Averaging rotations with euler angles or rotational matrices

I have been working on a small app that controls the rotation of a cubic map panorama via the gyroscope of a mobile device or tablet. I finally have it working, albeit roughly. My solution involved converting the euler angles coming in from the gyroscope into rotational matrices and passing those matrices through various modification matrices.

Now that I have this working, I am looking to smooth out the animation. I was thinking it would be best to collect rotational data in an array and then take their average. However, I am totally unsure how to do this.

Can I average the rotational matrices, or the euler angles themselves? Or am I going to need to convert the data into Quaternions and then apply some kind of averaging function?

Any help would be great. Thanks!

Upvotes: 1

Views: 2614

Answers (1)

Ali
Ali

Reputation: 58471

Can I average the rotational matrices, or the euler angles themselves?

Nope.

Or am I going to need to convert the data into Quaternions and then apply some kind of averaging function?

Yes, only quaternions are appropriate for inter/extrapolation. See 45:05 here (David Sachs, Google Tech Talk).

I haven't done smoothings like the one you are looking for but in any case, only quaternions are appropriate.

Quaternion Slerps are commonly used to construct smooth animation curves ...

From Wikipedia, Slerp.

Upvotes: 2

Related Questions