Jump to content
  • Advertisement
Sign in to follow this  
TheSeb

simple question about matrix computation

This topic is 4925 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, i have a matrix made of 4 lines and 3 columns, if i multiply it by a vector of 3 members(x, y, and z), will i get the same result than if i add a fourth column to the matrix (to have a 4x4 matrix)and the w component to the vector and if i multiply the new 4x4 matrix by the new vector (which have now four members) ? PS :the column added to the matrix would be : 0 0 0 1

Share this post


Link to post
Share on other sites
Advertisement
Yes, what you describe is a common implementation shortcut. Technically you can't multiply a 1x3 vector and a 4x3 matrix, but you can multiply a 1x4 vector and a 4x4 matrix. However, if the w component of the vector is always 1, and the right column (assuming row vectors) is always [0 0 0 1], then some of the operations become unnecessary. If you drop these operations, you end up with something like:

x' = x*m00+y*m10+z*m20+m30
y' = x*m01+y*m11+z*m21+m31
z' = x*m02+y*m12+z*m22+m32

With this you can perform transformations such as rotation, translation, scale, shear, reflection, etc. For other operations such as perspective projection, this shortcut won't work.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!