Sign in to follow this  
giugio

translation matrix

Recommended Posts

Hy. I have created with gamedev forum help a rotation matrix starting from AxisY, direction and position vector like: C3DMatrix R; R.m_Z = vAxisY; R.m_Y = (vAxisY ^ vDirection).Normalize(); R.m_X = R.m_Y ^ R.m_Z; R.m_Z is a vector with the last vector in a 3x3 matrix. R.m_Y is a vector with the center vector in a 3x3 matrix. R.m_X is a vector with the first vector in a 3x3 matrix. operator ^ is the cross product. all work fine , a point multiplied by this matrix change his rotational components correctly,thanks , but now i must create the translation matrix and i have the position vector . How? Thanks.

Share this post


Link to post
Share on other sites
Quote:
Original post gy giugio
now i must create the translation matrix and i have the position vector. How?
That depends on the structure of C3DMatrix. Does it have something like C3DMatrix.m_W? If so, than it is a good candidate. If, on the other hand, C3DMatrix is a 3x3 matrix only, then it is not able to represent translation at all.

Further, notice please that setting rotation and translation independently has a specific geometrical interpretation. Make sure that it is actually what you want. Perhaps you have to rotate the translation before setting it into the matrix.

BTW
Quote:
Original post gy giugio
a point multiplied by this matrix change his rotational components correctly
What's the rotational part of a point? There is usually nothing like that at all.

Share this post


Link to post
Share on other sites
no , there aren't C3DMatrix.m_W.
IS possible to construct a regular 3x3 matrix with the translation ?
How i can create the translation 3x3 matrix for transform independently ?
Thanks again haegarr.
by

Share this post


Link to post
Share on other sites
From your original post it seems me we're speaking of 3D space. In 3D space you use at least a 3x3 matrix for rotation (and perhaps scaling and shearing). But you cannot incorporate translation in it. On the other hand, if you have a 4x3 or a 4x4 matrix, then translation can be incorporated.

If the 3x3 matrix is all you have, then translation must be done manually by addition. E.g.
R * v + t
where R is the rotation matrix, v the position vector, and t the translation vector. Notice please that this is correct for position vectors only. For direction vectors the formula has to be reduced to
R * v
because direction vectors have no location property.

Perhaps you should look out for a "C4DMatrix" or the like? Are you working with your own math library, or are you using a foreign library?

Share this post


Link to post
Share on other sites
What you're asking is the same as: "I have a single float. How do I make that float into a rotation matrix"?

You can't - To do translation you need at least a 4x3 matrix. You only have a 3x3 matrix, there's no space in it for a translation.

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