Sign in to follow this  

3x3 matrices == 4x4 matrices without translations?

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

The 3x3 Matrix is the "Vector Space" transform of the basis vectors...

Your correct that you do not get any translational data, and you loose the ability to move anywhere...

Share this post


Link to post
Share on other sites
Hi,

Quote:
Original post by stringa
The 3x3 Matrix is the "Vector Space" transform of the basis vectors...

Your correct that you do not get any translational data, and you loose the ability to move anywhere...



According to you, if I copy _11, _12, _13, ... _31, _32 and _33 of a D3DXMATRIX to another D3DXMATRIX, I will only get rotational motion from the new matrix? because I've ignored _41, _42 and _43 of the original matrix?

I've checked Direct3D, there isn't any structure that is analogue to a 3x3 matrix!
Thanks
Jack

Share this post


Link to post
Share on other sites
Try your D3DX Libraries for helper functions.

As long as you leave out the 4th row and 4th column, you should have your 3 basis vectors.

The graphics pipe doesn't know the difference between 2D and 3D. It's just how you define your projection matrix and do the math that follows. Helper functions abstract math from the programmer. 2D help functions use 3x3 matricies with the 3rd column as the Translational Transform.

Share this post


Link to post
Share on other sites
Quote:
Original post by stringa
Try your D3DX Libraries for helper functions.

As long as you leave out the 4th row and 4th column, you should have your 3 basis vectors.

The graphics pipe doesn't know the difference between 2D and 3D. It's just how you define your projection matrix and do the math that follows. Helper functions abstract math from the programmer. 2D help functions use 3x3 matricies with the 3rd column as the Translational Transform.


Actually, my major concern is when I create a new 4x4 matrix (3D) without translations thru D3DXMATRIX, and if the constructor doesn't initialize the last row, I may get unpredicted results....

BTW, could you please introduce some helper functions to accomplish this?

Thanks
Jack

Share this post


Link to post
Share on other sites
I'm totally confused.

It seems as you don't want to do 100 % of the math.

If you using Visual Studio, type in 'D3DX' in some scope of the program and push "Alt" + "Right" to get a list of all the helper functions. I think "CTRL" + "SPACE" works too. If you use D3DXMatrixTransformation, you can do whatever you want in a single function call.

Enjoy...

Share this post


Link to post
Share on other sites
Quote:
Original post by stringa
I'm totally confused.

It seems as you don't want to do 100 % of the math.

If you using Visual Studio, type in 'D3DX' in some scope of the program and push "Alt" + "Right" to get a list of all the helper functions. I think "CTRL" + "SPACE" works too. If you use D3DXMatrixTransformation, you can do whatever you want in a single function call.

Enjoy...



"Alt+right" ha ha :) I never knew that and I am hopeless on math... but excuse me....

I think I should also tell you the story...
I wanted to build a matrix and a vector out of D3DXMATRIX, 3x3 matrix dedicated for rotation and a vector devoted to position. And I wanted to seperate this from one D3DXMATRIX because that was how the example (IK) works... here is some code snippet:


for (int i=32;i>0;i--) // 32 == iterations
{
set_transformations();

// extract the position of the homogeenous matrix
//const D3DXVECTOR3& position = rootframe->TransformationMatrix
D3DXVECTOR3 position(rootframe->TransformationMatrix._41, rootframe->TransformationMatrix._42, rootframe->TransformationMatrix._43);


}



What I do next is to extract the rotation off the matrix similar to "position" you seen here...



// set_transformation();
D3DXMATRIX& parenttransf = Currframe->parent->TransformationMatrix;
D3DXMATRIX& childtransf = Currframe->TransformationMatrix;

childtransf = parenttransf * childtransf;



And the point/objective is to make 3x3 matrix and a vector so that I can mimic what the example does for IK....

Thanks
Jack

[Edited by - lucky6969b on March 1, 2008 1:58:18 AM]

Share this post


Link to post
Share on other sites
For D3D, the translation portion of the matrix is contained in the _41, _42, and _43 members of the D3DXMATRIX class. Just pull those out and you're good to go. IIRC, all D3DXMATRIX objects initialize themselves to identity. If they don't, just call D3DXMatrixIdentity to set one. After that, you can set the 3x3 portion of the matrix to whatever you want.

Share this post


Link to post
Share on other sites
Quote:
Original post by MJP
For D3D, the translation portion of the matrix is contained in the _41, _42, and _43 members of the D3DXMATRIX class. Just pull those out and you're good to go. IIRC, all D3DXMATRIX objects initialize themselves to identity. If they don't, just call D3DXMatrixIdentity to set one. After that, you can set the 3x3 portion of the matrix to whatever you want.




D3DXMATRIX rotation;

D3DXMatrixIdentity(&rotation);
rotation._11 = rootframe->TransformationMatrix._11;
rotation._12 = rootframe->TransformationMatrix._12;
rotation._13 = rootframe->TransformationMatrix._13;
rotation._21 = rootframe->TransformationMatrix._21;
rotation._22 = rootframe->TransformationMatrix._22;
rotation._23 = rootframe->TransformationMatrix._23;
rotation._31 = rootframe->TransformationMatrix._31;
rotation._32 = rootframe->TransformationMatrix._32;
rotation._33 = rootframe->TransformationMatrix._33;


Very ugly (still coding right now)
But I think it is feasible.
Thanks
Jack

Share this post


Link to post
Share on other sites

This topic is 3578 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.

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