2
\$\begingroup\$

Usually, I do my matrix multiplication like this:

[1 0 0 dx] | [px]   [px + dx]
[0 1 0 dy] | [py]   [py + dy]
[0 0 1 dz] | [pz] = [pz + dz]
[A B C  1] | [1]    [1]

Where the translation is along the right-hand edge of the matrix.

Once, I forgot about that and put them on the lower line instead, on the places marked as A B C above.

What did that do to the resulting points? With the upper-left 3x3 being an identity matrix, and the translation being zero, nothing happened to my point

[1 0 0 0] | [1]   [1]
[0 1 0 0] | [1]   [1]
[0 0 1 0] | [1] = [1]
[1 2 3 1] | [1]   [7]

except that 1 we always use in fourth place gets changed. Does this mean further multiplication with the point results in a mess? What am I doing by changing the bottom row?

\$\endgroup\$
2
\$\begingroup\$

The fourth column (or row, depending on your preferred convention) is used for projection. For example, the following page gives a good overview of perspective projections in Direct3D: Projection Transform (Direct3D 9) and the following for orthographic projection.

\$\endgroup\$
2
\$\begingroup\$

The 3-tuple diagonally opposite the translation tuple in a 4x4 transformation matrix (in other words, the bottom row in your example, but note that it could be the right column if you are multiplying you vertices on the right instead, which is another equally valid convention) usually isn't used. It will have non-zero values when the matrix is used to represent certain kinds of projection (such as perspective projection).

It's important to remember that a 4x4 matrix is a more general mathematical concept than a "3D transformation," and that not all permutations of re-presentable 4x4 matrices have corresponding geometric interpretations.

In other words, the fact that the right row "contains the transformation" is more of a happy accident of the way the math works out and not an intrinsic property of a 4x4 matrix in general.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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