Jump to content
  • Advertisement
Sign in to follow this  
jenny_wui

Extracting only z rotation matrix from a rotation matrix

This topic is 2055 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

Hello,

       I have a 3X3 rotation matrix. I have small 3D model. I only need to consider z rotation for that model, I don't need to consider xy movement or rotation. How can I extract the matrix that only consider z rotation of the model from the given rotation matrix?

       Thanks every body in advance.

Share this post


Link to post
Share on other sites
Advertisement
There's no clear definition of what "the z rotation" means. Your best bet is to start with some sort of description of the rotation in terms of Euler angles and then to pick one of them. But there are many different possible setups, and I am not sure which one would map to whatever you think "the z rotation" means. Edited by Álvaro

Share this post


Link to post
Share on other sites

yeah, exactly the first thing I thought Alvaro: what is jenny_wui's definition of z rotation.

However in the meantime:

searching the net on the title phrase such as "extract rotation from 3X3 opengl rotation matrix" will help. 

This might help too: http://www.soi.city.ac.uk/~sbbh653/publications/euler.pdf

personally If I had a choice I would tend to store representations of rotations as variables to be placed into matrices as opposed to an angle extraction option.

Share this post


Link to post
Share on other sites

Wow frob. Thanks. I've been messing around with a ton of matrix operations lately and I understood the high level concepts. This post seems to explain away some of the magic and it's starting to make sense to me. :)

 

Very cool post.

 

- Eck

Share this post


Link to post
Share on other sites

If I'm not mistaken, you would extract only the Z rotation if you create a matrix with the inverse of all the other rotations (X or "pitch," and Y or "yaw") and leave the Z or "roll" row as 1.
Then when multiplying 'Original x Inverse,' you would obtain a matrix that has only the Z rotation present, with the other rotations set to identity (or "removed").
http://en.wikipedia.org/wiki/Transformation_matrix#Composing_and_inverting_transformations

A rotation matrix with only the Z rotation is a matrix with all the other rows set to identity, except the Z row.

Edited by Kryzon

Share this post


Link to post
Share on other sites
Hello, thanks a lot for the information. I would just like to double-check whether working ok. Please let me know in the following code, whether I've been able to transform "point" to "point_transformed_x" correctly using only the z basis vector/ If not please let me know how to do it the proper way.

Thank you very much.

/******************************************************/

Point3D point, point_transformed_x;

Point.x = 50.0;
Point.y = 70.0;
Point.z = 0.0;

// extracted Z basis vector for rotation matrix

double rotation_matrix[16] = {1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
-0.0871186, -0.169623, 0.981651, 0,
0, 0, 0, 1};


Point_transformed_x = 50.0* rotation_matrix[0] + 70.0* rotation_matrix[1] + 0.0* rotation_matrix[2];

Point_transformed_y = 50.0* rotation_matrix[4] + 70.0* rotation_matrix[5] + 0.0* rotation_matrix[6];

Point_transformed_z = 50.0* rotation_matrix[8] + 70.0* rotation_matrix[9] + 0.0* rotation_matrix[10];

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!