Simple Matrixes explanation.

No, they’re not Matrixes, but it makes me giggle. Unlike trying to work with the buggers.

I wondered if someone could give me a brief, non mathematical explanation of what some of them do. I have a bit of code which I have taken from a web page explaining pixel collision with rotated sprites.

There is one line of code that creates a Matrix, translates, rotates and translates.

Now, what exacty does CreateTranslation do? Does it just create a blank matrix to be worked on?

And why is there a CreateTranslation, then a CreateRotation, then another CreateTranslation?


It would be easier to explain, if you posted some code you don’t understand :).
Matrix.CreateTranslation just calculates a basic translation in space. It’s just a matrix that moves point (or points) along a 2D/3D vector.
When you multiply your matrices it is very important to do it in the correct order, example:
Transformation = Translation * Rotation * Scale
In this “equation” you have to look from right to left, so the order is:

  1. Scale
  2. Rotate
  3. Translate

Matrices are frequently used in computer graphics for a variety of purposes, including representation of spatial transformations.

See [affine transformations on Wikipedia] ( for more information on Translation, Rotation, Scale, etc operations with matrices.