Jump to content
  • Advertisement
Sign in to follow this  
mauzi_the_Dude

receive yaw pitch and roll from a 4x4 Matrix

This topic is 4776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, sorry if this is a newbee question. i´m using ode.net and it uses a 4x4Matrix for the orientation, how do i extract yaw, pitch and roll since they are only 3 3dimensinal vetors?? does pitch(yaw or roll) equal Matrix position 1.1, 1.2, 1.3(horizontal) or is the vertical 1.1, 2.1, 3.1 ? if so what are is the fourth dimension for ... ? is there a standard or is it used differently in other projects ? thnx greetz the Dude

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by mauzi_the_Dude
hi,

sorry if this is a newbee question.
i´m using ode.net and it uses a 4x4Matrix for the orientation, how do i extract yaw, pitch and roll since they are only 3 3dimensinal vetors??


You want to extract the Euler orientation out of a 4x4 matrix?

Quote:

does pitch(yaw or roll) equal Matrix position 1.1, 1.2, 1.3(horizontal) or is the vertical 1.1, 2.1, 3.1 ?


No, it's not nearly that simple.

Sorry, I can't remember the math off the top of my head, but it's more complicated that just looking at a single component of the matrix.

Share this post


Link to post
Share on other sites
Yaw, pitch, and roll are angles, not vectors. So, since you're looking for vectors I think you're not looking for "yaw, pitch, and roll", but simply the basis vectors for the oriented object's local coordinate frame.

You basically got that right! That is, the 3 basis vectors are EITHER the 3 rows or the 3 columns of the upper 3x3 part of the transformation matrix. Whether it is rows or columns depends on how ODE is applying multiplications, e.g., whether it treats the transformation as "row-wise" or "column-wise". I haven't looked at it carefully enough to know how its working, and the docs don't seem to say explicitly.

As to why there's a 4th row and column, this is because coordinates are being represented in so-called "homogeneous" coordinates. It makes for quite convenient pure-matrix transformations that include translation, rotation, and scale all in one step. The OpenGL red book is a one place to learn about homogeneous transformations:

Homogenous Coordinates and Transformation Matrices

Share this post


Link to post
Share on other sites
found something: ( and sorry, i didn´t say i was looking for the direction Vector3 :( my bad )
Q5. How do matrices relate to coordinate systems?
--------------------------------------------------
With either 3x3 or 4x4 rotation, translation or shearing matrices, there
is a simple relationship between each matrix and the resulting coordinate
system.
The first three columns of the matrix define the direction vector of the
X, Y and Z axii respectively.
If a 4x4 matrix is defined as:

| A B C D |
M = | E F G H |
| I J K L |
| M N O P |

Then the direction vector for each axis is as follows:

X-axis = [ A E I ]
Y-axis = [ B F J ]
Z-axis = [ C G K ]


source: http://www.j3d.org/matrix_faq/matrfaq_latest.html#Q5


thnx didn´t see your post, i´ll look up the source, but thats what i was looking for ....

Share this post


Link to post
Share on other sites
I know nothing about 4x4 equations. But here is the math for 3D rotations
that solved my problem with airplane control in DirectX7 that allowed total roll, pitch, and yaw.

I'm doing this from memory so if i'm in error please forgive me.


--------------------------------------------------------
in this equation:


UP:
Z+ is up. (pitch)
To rotate in a stationary location:
Distance = 1
To move the point along the new angles:
Distance = Distance To Move Along new Roational Angles
Eleminate the:
X + (
Y + (
Z + (
Result is rotation around the world's 0,0,0 axis.

Pi = 3.14....ect
180 / pi = Radients value of angle







The Code:



Pitch = PitchAngle * (180 / pi)
Yaw = YawAngle * (180/pi)
Roll = rollAngle * (180/pi)



NewX = X + (Sin(Pitch) * Cos(Yaw) * Cos(Roll) * Distance)
NewY = Y + (Sin(Pitch) * Sin(Yaw) * Cos(Roll) * Distance)
NewZ = Z + (Cos(Pitch) * Sin(Roll) * Distance)

Point.x = NewX
Point.Y = NewY
Point.Z = NewZ






If i'm in error, then the error will mostlikely be in the
Cos(Roll)
and
Sin(Roll)
portions of the code.

Share this post


Link to post
Share on other sites
Euler angle extraction:

http://q12.org/pipermail/ode/2004-September/013862.html
http://www.acm.org/pubs/tog/GraphicsGems/gemsiv/euler_angle/ (many permutations)
http://www.acm.org/pubs/tog/GraphicsGems/gemsiv/euler_angle/EulerAngles.c

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!