Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm in the process of reading up on 3d matrices and trying to following this powerpoint and had a few questions as to how to exactly determine the type of transformation from a matrix.

If I have a matrix such as...

a 0 0
0 b 0
0 0 1

or

1 0 a
0 1 b
0 0 1

...would these be considered a translation by (a, b) vector?

Or a matrix such as...

cos(a) -sin(a)   0 
sin(a)  cos(a)   0
  0        0     1

... would this be considered rotation about Z-axis through the angle a?

Is there a better way to visualize these?

share|improve this question
    
Do you want to represent linear transformations in 3D or affine transformations in 2D? If linear in 3D, there is no translation! if affine in 2D, there is no Z-axis! –  Ivan Kuckir Mar 29 '13 at 13:57

1 Answer 1

up vote 4 down vote accepted

The best way to gain intuition about how a matrix behaves is by determining its effect on the standard basis vectors:

     1        0        0
e1 = 0   e2 = 1   e3 = 0
     0        0        1

Since any 3D vector can be written as a combination of a*e1 + b*e2 + c*e3, if we know how a matrix changes these three vectors, we know how a matrix changes any vector.

So, to start off, let's examine the first matrix you have:

    a 0 0
M = 0 b 0
    0 0 1

We can see that

         a              0              0
e1 * M = 0     e2 * M = b     e3 * M = 0
         0              0              1

Hence, we see that e1 gets scaled by a, e2 gets scaled by b, and e3 stays the same. Since we don't know whether or not a equals b, or even if they are equal to one, this is a skew matrix.

If we perform a similar analysis to the matrix

    1 0 a
M = 0 1 b
    0 0 1

we see that e1 and e2 do not change, but e3 changes drastically. This means that every vector in the XY plane will remain the same, but every vector that has a nonzero z coordinate will become distorted! So, to answer your question, neither of these are translation matrices.

As your intuition might tell you by this point, you cannot translate a 3D vector using only 3x3 matrices. For that you need to use homogeneous coordinates.

I would suggest you go through these steps with the last matrix you have written. Spoiler alert: it is indeed a rotation about the z-axis.

share|improve this answer
2  
The second one could be a 2D translation in homogeneous cords, an affine transformation. –  luser droog Mar 29 '13 at 5:44

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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