• What is your GameDev Story?

This topic is 5020 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

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 on other sites
It depends on the contents of the last row.

Share on other sites
if it is the translation part ?

Share on other sites
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.

• What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 9
• 31
• 16
• 11
• 10
• Forum Statistics

• Total Topics
634121
• Total Posts
3015613
×