5
$\begingroup$

I've been reading around that matrices (for example, rotation matrices, but not only) can be thought somehow as coordinate systems.

My question is: how is that possible?

I've seen for example that if we're using row-major conventions, the rows of the matrices involved in the transformations (specifically I've seen about rotations) can be thought as the vectors representing some coordinate system (specifically it should be a local coordinate system).

Why is this the case? And why specifically a local coordinate system? What does it even mean local coordinate system in this context? Are there any other type of matrices, apart from the rotation matrices, which can be thought as coordinate systems? If yes, which ones, and why?

Matrices usually represent a transformation (linear or not, maybe also affine in computer graphics), but it's new to me to think about matrices as coordinate systems.

$\endgroup$
  • $\begingroup$ It does not matter if its row oriented column oriented or arbitrary otder or inverse its still the same case. This is not because of math but what we are trying to acieve. Math does not deal with the why as much as you like to believe, math deals with properties of abstract things, the interpretation has to come from oitside of math. But its better you smartly ask the space question you originally tried ton $\endgroup$ – joojaa Jan 13 '17 at 7:33
  • $\begingroup$ Please check scratchapixel.com/lessons/… $\endgroup$ – user18490 Jan 20 '17 at 9:30
  • $\begingroup$ @user18490 Yes, in this case, this question arose after reading a lesson from scratchpixel. In my opinion it's not understandable enough the explanation there. $\endgroup$ – nbro Jan 20 '17 at 10:32
5
$\begingroup$

If you have a 3x3 matrix representing some transformation, you will actually have the X,Y,Z vectors of that transformation in the rows or columns (depending on if it's a row major or column major matrix).

In other words, if you have a 3x3, you can look at it and immediately get the up, right(*), forward vectors (asterisk due to handedness, it could be the left vector).


3x3 Details:

let's say you have a 3x3 matrix $M$:

$ M_{ij} = \begin{bmatrix} M_{1,1} & M_{1,2} & M_{1,3} \\ M_{2,1} & M_{2,2} & M_{2,3} \\ M_{3,1} & M_{3,2} & M_{3,3} \\ \end{bmatrix} $

Let's see what happens when you multiply that by a vector $\begin{bmatrix}1,0,0 \end{bmatrix}$:

$ \begin{bmatrix} M_{1,1} & M_{1,2} & M_{1,3} \\ M_{2,1} & M_{2,2} & M_{2,3} \\ M_{3,1} & M_{3,2} & M_{3,3} \\ \end{bmatrix} * \begin{bmatrix} 1 \\ 0 \\ 0 \\ \end{bmatrix} = \begin{bmatrix} M_{1,1} \\ M_{2,1} \\ M_{3,1} \\ \end{bmatrix} $

Now let's try vector $\begin{bmatrix}0,1,0\end{bmatrix}$:

$ \begin{bmatrix} M_{1,1} & M_{1,2} & M_{1,3} \\ M_{2,1} & M_{2,2} & M_{2,3} \\ M_{3,1} & M_{3,2} & M_{3,3} \\ \end{bmatrix} * \begin{bmatrix} 0 \\ 1 \\ 0 \\ \end{bmatrix} = \begin{bmatrix} M_{1,2} \\ M_{2,2} \\ M_{3,2} \\ \end{bmatrix} $

And lastly, vector $\begin{bmatrix}0,0,1\end{bmatrix}$:

$ \begin{bmatrix} M_{1,1} & M_{1,2} & M_{1,3} \\ M_{2,1} & M_{2,2} & M_{2,3} \\ M_{3,1} & M_{3,2} & M_{3,3} \\ \end{bmatrix} * \begin{bmatrix} 0 \\ 0 \\ 1 \\ \end{bmatrix} = \begin{bmatrix} M_{1,3} \\ M_{2,3} \\ M_{3,3} \\ \end{bmatrix} $

This shows that whatever matrix $M$ is, the first column is the X axis vector of the coordinate space defined by the matrix. The second column is the Y axis vector, and the third column is the Z axis vector.

These vectors are in global space.

$ M = \begin{bmatrix} X_x & Y_x & Z_x \\ X_y & Y_y & Z_y \\ X_z & Y_z & Z_z \\ \end{bmatrix} $

You can even see that this is true in an identity matrix, where the X,Y and Z vectors are just what you'd expect them to be:

$ M = \begin{bmatrix} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} $


A 3x3 matrix is much like a vector in that it describes directions but has no position.

If you have a 4x4 matrix that represents a 3d transform and uses homogeneous coordinates for a translation, you can then use that to get the X,Y,Z orientation vectors, but also can get the translation from the origin.

Hopefully this is helpful, and not misleading for less common matrix types. I saw an answer deleted which said similar, so fingers crossed :P

$\endgroup$
  • $\begingroup$ "immediately get the up, right(*), forward vectors": could you please specify which rows or columns represent the X, Y or Z axis, and why? $\endgroup$ – nbro Jan 12 '17 at 18:38
  • $\begingroup$ let me know if that helps nbro! $\endgroup$ – Alan Wolfe Jan 12 '17 at 19:31
  • $\begingroup$ Yes, that was helpful, thanks! I've another doubt. You say "you can look at it and immediately get the up, right(*), forward vectors", you're saying of the local coordinate system? According to the answer provided by @Oliver, this matrix defines a new coordinate system with respect to another, but this is often implicit. This kind of makes sense to me if I imagine at the end that this matrix represents a transformation. But what I'm confused about now is if the columns (or rows) of the transformation matrix actually define the basis of the new space... I should go back to review this. $\endgroup$ – nbro Jan 12 '17 at 19:47
  • $\begingroup$ Yes. In my example, you can use the columns to get the basis vectors of the coordinate system it describes. The columns are in the coordinate system of whatever the parent coordinate system is. If there is no parent coordinate system, they are in global space. Else, they are in the coordinate system of the parent. HTH but i understand that sometimes it takes time and multiple attempts to absorb new concepts :P $\endgroup$ – Alan Wolfe Jan 12 '17 at 19:54
  • $\begingroup$ When you say "The columns are in the coordinate system of whatever the parent coordinate system is" you mean "the columns are in the vector space of whatever..."? $\endgroup$ – nbro Jan 12 '17 at 19:57
2
$\begingroup$

A matrix can be used to transform a coordinate system into a new one. More specifically, it can be used to transform the basis vectors of a coordinate system. That's how it defines a new coordinate system. It is of course always in relation to another coordinate system but that is often implicit.

local coordinate system usually means a coordinate system which is specific to only part of your scene. For example, the coordinate system where an object's vertices are defined. Those vertices are then transformed, with a matrix, to some global coordinate system with the rest of the scene. That's why it is said that the matrix defines the local coordinate system, in relation to the global one.

With that said, there can be a number of other meanings. Texture coordinates are also a form of local coordinate system: a 2D one defined on a surface. It is specific to that surface and it is usually not defined by a transformation matrix.

$\endgroup$

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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