XNA for C#
DirectX 9 for C#
DirectX 9 for C++
DirectX 9 for VB
My XNA Book
       Go to section on this site

Additional info

Latest Forum posts

 Account settings
  Posted by: Anonymous
  When: 07/05/2014 at 09:48:39

 forced subtitle
  Posted by: Applefly
  When: 07/05/2014 at 06:00:48

 convert DVD into PMS
  Posted by: Applefly
  When: 07/05/2014 at 05:55:25

 DVD to Digital Copy easily
  Posted by: VIKIVannessa
  When: 05/05/2014 at 06:52:29

 DVD on Xbox 360/Xbox One Console
  Posted by: VIKIVannessa
  When: 05/05/2014 at 06:51:47

 Extract .Srt Subtitles
  Posted by: Applefly
  When: 04/05/2014 at 03:54:38

 Encode Movie collection
  Posted by: Applefly
  When: 04/05/2014 at 03:52:41

 Convert DVD to WMV
  Posted by: Applefly
  When: 29/04/2014 at 05:53:50

 rip DVDs into digital files
  Posted by: Applefly
  When: 29/04/2014 at 05:51:20

 iTunes movies/music to Kindle Fire
  Posted by: ciciyu80
  When: 29/04/2014 at 05:10:20


Homogeneous matrices

If you access one of the matrices used by DirectX, youíll see they have 16 components, which means they consist of 4 rows and 4 columns. This format was chosen, to allow these matrices to also represent translations.

To translate a point, we need to ADD a number to each of its components. By using 3x3 matrices, we can only get coordinates that are multiples of the original coordinates. So next to X,Y and Z, weíll add a constant to our coordinates. For simplicity, letís set this to 1. So from now on, weíre going to represent 3D points by 4 coordinates. For example, the point at position (10,5,0) will get coordinates (10,5,0,1). These coordinates are called the homogeneous coordinates of a point.

The scaling and rotation matrices remain the same, but the get an additional row and columns that are 0, except for the point m44, which is 1. Here you can see what the scaling and Y-rotation matrices look like in their homogenous form:

This looks a little bit more complex, but now we can at last also define a translation matrix:

Letís have a look at a small example. Suppose we want to translate the point (10,5,0) into the direction (-8,2,4). This is how itís done:

So this gives use the point (2,7,4). This result is of course very obvious, but the point Iím trying to make here is that now we fulfill the 3 basic properties:

1) We have a matrix corresponding to every basic transformation
2) Multiplying such a matrix with the coordinates of a point will give the coordinates of the transformed point
3) Multiplying 2 matrices gives a new matrix, that corresponds to the combined transformations, corresponding to the 2 starting matrices

If you have been following up to this point, youíll notice the 4th coordinate has absolutely NO geometrical meaning. Itís just there to allow us to define a translation matrix, that has the same shape as a scaling and rotation matrix.

This actually concludes these pages on matrices. One final remark however: sometimes youíll notice this constant is not 1, as was the case in this theory. In fact, the general rule says you simply have to divide the X,Y and Z coordinate by this 4th coordinate. Letís call this 4th coordinate W from now on.

Put simply: (20,10,0,2) = (10,5,0,1) both represent the same 3D point (10,5,0). So the simple rule to derive the 3D point out of 4 coordinates is:

Click here to go to the forum on this chapter!

Or click on one of the topics on this chapter to go there:
  • Confused with homegenous
          Hi riemer, Long time no see, I've been busy ;)...
  • Laatste deel van deze homogene matrices
          Can you explain the last part of it? If you wan't...


    If you appreciate the amount of time I spend creating and updating
    these pages, feel free to donate -- any amount is welcome !

    - Website design & XNA + DirectX code : Riemer Grootjans -
    ©2003 - 2011 Riemer Grootjans
  • Translations

    This site in English
    This site in Korean
    This site in Czech

    Microsoft MVP Award

    2007 - 2011 MVP Award
    DirectX - XNA


    XNA 2.0 Recipes Book (8)
    XNA 3.0 Recipes Book (8)
    Extra Reading (3)
    Matrices: geometrical
    Matrix Mathematics
    Homogenous matrices
    Community Projects (1)
    Tutorials (160)
    -- Expand all --

    Thank you!

    Support this site --
    any amount is welcome !

    Stay up-to-date

    I don't have the time to keep a News section, so stay informed about the updates by clicking on this RSS file!