# Calculate Rotation Matrix

Hey everyone!

I have two rotation matrices, r1 and r2.

r1 is created from three given base vectors a, b, c.

r2 is created by rotating about given yaw, pitch, roll angles. Yaw about Y-axis, Pitch about X-axis, roll about Z-axis.

I now want to know how what transformation matrix I need to get from r1 to r2.

Also, I'd like to know what specific yaw, pitch, roll angles I need to get from r1 to r2.

At first I thought it would simply be

r3 = r1 * r2^-1

But I don't think that is correct.

Here's an example:

r1 = createRotationMatrix(45, 45, 45); //(yaw, pitch, roll)

r2 = createRotationMatrix(60, 60, 60);

r3 = createRotationMatrix(15, 15, 15);

Basically, what I'm trying to do is to calculate r3 from r1 and r2.

Is that even possible with matrix multiplications, or do I have to calculate the Euler Angles inside r1 and r2 and then create a new matrix r3 using these?

Thanks in advance,

Jarod

Your close, and definetly on the right track......

To get "from" r1 "to" r2 you need to use r3=r1^-1 * r2

To make sense of it, think about it this way....

* your "object" is at location and orientation r1 (local coordinate system)

* r2 is relative to the world coordinate system (axis aligned and at the

origin)

* by multiplying your object by the inverse of it's local coordinate system you

essentially place it back at the origin and axis aligned

* Then all you need to do is multiply it by r2 to get it to the target location

By creating r3 above you now have a transform that does it all...... "object"

at location r1 * r3 places it at r2

You can then extract yaw-pitch-roll from r3

I hope this helps

Don Casteel

Freelance Portfolio Deviant Art Home

Deviant Art Gallery

Project Home

________________________________

From: "java3d-interest@javadesktop.org"

To: interest@java3d.dev.java.net

Sent: Thu, August 12, 2010 6:43:18 AM

Subject: Calculate Rotation Matrix

Hey everyone!

I have two rotation matrices, r1 and r2.

r1 is created from three given base vectors a, b, c.

r2 is created by rotating about given yaw, pitch, roll angles. Yaw about Y-axis,

Pitch about X-axis, roll about Z-axis.

I now want to know how what transformation matrix I need to get from r1 to r2.

Also, I'd like to know what specific yaw, pitch, roll angles I need to get from

r1 to r2.

At first I thought it would simply be

r3 = r1 * r2^-1

But I don't think that is correct.

Here's an example:

r1 = createRotationMatrix(45, 45, 45); //(yaw, pitch, roll)

r2 = createRotationMatrix(60, 60, 60);

r3 = createRotationMatrix(15, 15, 15);

Basically, what I'm trying to do is to calculate r3 from r1 and r2.

Is that even possible with matrix multiplications, or do I have to calculate the

Euler Angles inside r1 and r2 and then create a new matrix r3 using these?

Thanks in advance,

Jarod

[Message sent by forum member 'jarodrussell']

http://forums.java.net/jive/thread.jspa?messageID=479997

---------------------------------------------------------------------

To unsubscribe, e-mail: interest-unsubscribe@java3d.dev.java.net

For additional commands, e-mail: interest-help@java3d.dev.java.net

[att1.html]

Thank you very much!