So I have a series of points and a $4\times4$ transformation matrix. I have a bit of understanding of whats going on but what exactly am I multiplying and in what order?

I get the top left $3\times3$ is the rotation and the top $3$ values of the rightmost column are the translation and the scale is in there too.

And my point is a $1\times3$ or $3\times1?$

Something like:

[x]   [a b c]    
[y] x [e f g]  +  [d h l]    ?
[z]   [i j k]

given that my matrix is:

[a b c d]
[e f g h]
[i j k l]
[m n o p]
  • $\begingroup$ I don't think its clear what you are asking. However, note that the matrix multiplication $\begin{pmatrix} x \\ y \\ z \end{pmatrix} \begin{pmatrix} a & b & c \\ e & f & g \\ i & j & k \end{pmatrix}$ is not defined. This is a $3 \times 1$ matrix times a $3 \times 3$ matrix. If you have a $n \times m$ matrix $A$ and and $k \times \ell$ matrix $B$ then $AB$ is defined only when $m=k$. $\endgroup$ – Eric Dec 6 '18 at 16:52
  • $\begingroup$ So to clarify a bit. If you look at a dae file, a mesh is made up of a series of points. If multiple objects in the model use the same mesh but in different positions or orientations there is a 4x4 matrix to allow you to transform the original mesh for another object. Ignore my attempt, just asking what the steps are to get the points in my transformed mesh given the original set and a 4x4 matrix. $\endgroup$ – user1711383 Dec 6 '18 at 17:09
  • $\begingroup$ The usual way you would use a matrix $A$ to transform a vector space is just mapping a vector $v$ to $Av$. I am not familiar with dae files and it feels like there is something I am missing. $\endgroup$ – Eric Dec 6 '18 at 17:18
  • $\begingroup$ Think I found my answer here -math.stackexchange.com/questions/89621/… Thanks for your input $\endgroup$ – user1711383 Dec 6 '18 at 19:02

If the last column of the transformation gives the translation, then points are being represented as column vectors and you left-multiply by the matrix to transform them. Further transformations chain leftwards from this. Typically, instead of splitting apart the matrix in order to compute the image of the point, you would convert to homogeneous coordinates by appending a $1$ to the point’s coordinate vector and multiplying that by the full $4\times 4$ matrix: $$\begin{bmatrix}a&b&c&d\\e&f&g&h\\i&j&k&l\\m&n&o&p\end{bmatrix} \begin{bmatrix}x\\y\\z\\1\end{bmatrix}.$$ To recover the inhomogeneous Cartesian coordinates of the point, you divide through by the last element of the vector, unless it’s zero, in which case you have a point at infinity.

If the last row of the transformation matrix is $(0,0,0,1)$, then you have an affine transformation and can take some short cuts. (The upper-left $3\times3$ submatrix is the linear part of the transformation, but might not in general be limited to a rotation.) The fourth element of the vector being transformed will remain unchanged, so you don’t need to bother with that part of the full multiplication. If you’re dealing exclusively with affine transformations, you can save a bit of storage and represent them with $3\times4$ matrices. (Of course, composing them requires expanding to $4\times4$, at least virtually.) This is a common convention: for example, Adobe’s PostScript language uses non-square matrices to represent transformations in 2-D. Leaving out the last row means that the resulting vector will only have three elements, but since we started by tacking a $1$ on to the end of the point’s coordinates and will eventually divide by that $1$ again after transforming, this all works out automatically.

On the other hand, if the last row of the transformation matrix isn’t a multiple of $(0,0,0,1)$, you’re dealing with a projective transformation of space and need to work with the full $4\times1$ homogeneous coordinate vectors.

  • $\begingroup$ Thanks for the bonus info, affine etc.. $\endgroup$ – user1711383 Dec 6 '18 at 19:56

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.