Sign in to follow this  
jenny_wui

Extracting only z rotation matrix from a rotation matrix

Recommended Posts

jenny_wui    200

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
alvaro    21246
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
steven katic    275

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
Eck    7581

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
Kryzon    4626

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
jenny_wui    200
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this