5
\$\begingroup\$

To translate an object from (x, y, z) to (a + x, b + y, c + z) it's done using:

enter image description here

OK, that's cool, but why would we multiply in the first place when we can add the two matrices directly as:

enter image description here

addition is faster and more effective, plus it's straightforward?

\$\endgroup\$
  • \$\begingroup\$ Isn't this more of a math question than a game development question? \$\endgroup\$ – Anko Jan 16 '14 at 10:08
  • \$\begingroup\$ @Anko This is more about the implementation and applied part in graphics than the mathematical part. \$\endgroup\$ – GAX Jan 16 '14 at 10:22
  • \$\begingroup\$ This question is mostly opinion-based. Addition is indeed more effective and straightforward, but what makes you think that it isn’t actually used? I add vectors together all the time. \$\endgroup\$ – sam hocevar Jan 16 '14 at 10:47
  • \$\begingroup\$ Voting to close, as the premise of the question is wrong, since it assumes that translation is always done using multiplication, which is simply not true. It's a matter of opinion, personal preference and circumstance as to which one to use. No-one is forcing you to use full 4x4 matrix operations to do a simple translation. \$\endgroup\$ – MrCranky Jan 16 '14 at 12:22
3
\$\begingroup\$

because it allows to combine rotation and translation into a single matrix. Multiplying those matrices together gives use the concatenated operation. We can rotation around an arbitrary point P by first translating to -P then rotating and then translating by P.

multiplying these matrices together gives us a single matrix we can apply blindly without having to worry about knowing when to add a vector and when to multiply with a matrix

\$\endgroup\$
3
\$\begingroup\$

You can store ALL transformations in one matrix, rather than a matrix and a vector. Also, matrices are associative. This means a translation, then a rotation, is not the same as a rotation and then a translation. The translation could be affected by the previous rotations, or scales. This could be useful.

Also, when multiplying a 4*4 matrix with a 4 component vector, we could make the forth component of the vector 0, meaning it'll ignore the translation. A vector with a forth component of 0 means it's normalised. We don't want a normalised vector to me translated.

Yes, you could do all of this without matrices. It's just simpler and faster this way. You especially wouldn't want to manipulate a game with half matrices and half vectors.

\$\endgroup\$
  • \$\begingroup\$ I'm know that rotation => translation is not the same as translation => rotation, but I can't relay see how this answers why it's done using multiplication and not addition. \$\endgroup\$ – GAX Jan 16 '14 at 9:59
  • \$\begingroup\$ Because rotation and scale are not done through addition. We can't do a multiplication AND an addition in the same operation. \$\endgroup\$ – Ben Jan 16 '14 at 10:01
  • 1
    \$\begingroup\$ I think you mean "matrix multiplication is non-commutative" (or, in general, affine transformation is non-commutative) rather than "matrices are associative". \$\endgroup\$ – Peter Taylor Jan 16 '14 at 16:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.