Rotation

28 views
Skip to first unread message

bowljoman

unread,
Oct 2, 2010, 5:57:57 PM10/2/10
to jinngine
I know it may seem simple, but how do I get the x,y,z rotation angles
from the rotation matrix?


Thanks

Andy

mo

unread,
Oct 3, 2010, 5:20:46 AM10/3/10
to jinngine
Sounds like you want the Euler angles of the rotation. Jinngine uses
quaterntions to represent rotations, and the rotation matrix is
directly computed from the quaternion. This is standard allover. There
is a wiki on converting quaternions to euler angles here

http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles

I think i would give that a go. But as you will notice, such
conversion involves functions like arctan() etc, which is okay, but
nicer to avoid if possible.

It all depends on what you need to do with the euler angles?

Andy Shaules

unread,
Oct 3, 2010, 12:32:07 PM10/3/10
to jinn...@googlegroups.com
Hello,

Yeah, I do. My memory of vector math is kind of fuzzy as it is, so
swallowing a matrix4 concept last night was hard for me. I want the euler
angles because I'm using away3d as the rendering engine and, although I'm
sure underneath that frame work I may find the quanternion values, on the
surface, they use euler angles for their API. My main goal was to whip
something together and I limited the amount of time I spent learning the
math. I just wanted to show a simple integration.

As it is, I was very impressed with the display. I'll take another look at
the angles.

Andy

mo

unread,
Oct 3, 2010, 12:56:15 PM10/3/10
to jinngine
Scrunching
Scrounging around in the away3d API I found this function

http://away3d.com/livedocs/3.5.0_lib/away3d/core/math/MatrixAway3D.html#quaternion2matrix()

Using that function, you could just plug-in the 4 quaternion values
from Body.state.orientation, and obtain the rotation matrix you want.

Knowing nothing about away3d, this is a pretty much a shot in the
dark. But I hope it could work in your app...

-mo

On Oct 3, 6:32 pm, "Andy Shaules" <bowljo...@gmail.com> wrote:
> Hello,
>
> Yeah, I do. My memory of vector math is kind of fuzzy as it is, so
> swallowing a matrix4 concept last night was hard for me. I want the euler
> angles because I'm using away3d as the rendering engine and, although I'm
> sure underneath that frame work I may find the quanternion values, on the
> surface, they use euler angles for their API. My main goal was to whip
> something together and I limited the amount of time I spent learning the
> math. I just wanted to show a simple integration.
>
> As it is, I was very impressed with the display. I'll take another look at
> the angles.
>
> Andy
>
>
>
> ----- Original Message -----
> From: "mo" <mor...@silcowitz.dk>
> To: "jinngine" <jinn...@googlegroups.com>
> Sent: Sunday, October 03, 2010 2:20 AM
> Subject: [jinngine] Re: Rotation
>
> Sounds like you want the Euler angles of the rotation. Jinngine uses
> quaterntions to represent rotations, and the rotation matrix is
> directly computed from the quaternion. This is standard allover. There
> is a wiki on converting quaternions to euler angles here
>
> http://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler...
Reply all
Reply to author
Forward
0 new messages