0

I understand how to apply matrices in computer graphics, but I don't quite understand why this is done. For example in translation: to translate vector (x, y, z) by vector (diffX, diffY, diffZ) you could simply just add the vectors together instead of creating a translation matrix:

[1 0 0 diffX]
[0 1 0 diffY]
[0 0 1 diffZ]
[0 0 0   1  ]

and then multiplying the vector by the matrix to get (x+diffX, y+diffY, z+diffZ). Surely applying matrices like this would be wasteful of performance and memory?

MaximV
  • 155
  • 11
  • 2
    because [matrices](https://stackoverflow.com/a/28084380/2521214) can stack up any number of transformations in single resulting matrix speeding up the computations a lot. That is not doable in the approach you mentioned. For example imagine you want to render a robotic arm ... and want to transform the final part (hand/tool) for rendering with matrices you compute resulting matrix and apply it to each vertex... with split translation and rotation you would need to apply every consequent transform of each previous joint for each vertex of the mesh and that is way much slower and complicated – Spektre Jun 10 '20 at 15:19
  • @Spektre are you saying that I can multiply matrices together to have one resulting matrix to apply to the vector, if so surely the order of this multiplication would matter? – MaximV Jun 12 '20 at 10:12
  • 1
    Exactly like that. And yes order matters however you can have a cumulative matrix that you change only on demand (that remembers all the transformations before) that is not possible with the splited method of transformations... – Spektre Jun 12 '20 at 12:24

0 Answers0