I've been introduced to local coordinates in contrast to the global ones which I was used to work on, where we have basically the camera at the origin.

For example, I've the following picture of a cube:

enter image description here

According to a slides that I've:

the object is rotated about the x-axis by $R$ and then translated by $T$

from the object's perspective, the world is first translated by $–T$ and then rotated about the (object's local) x-axis by $–R$

Not just the sign but also the order of the transformations changes. Why is that?

Note: I've some ideas, clearly, but I would like to hear a good answer with a mathematical explanation.

  • $\begingroup$ Including your initial ideas may help people to tailor the explanation and highlight any misconceptions. $\endgroup$ – trichoplax Oct 25 '16 at 22:14

If you have object$\rightarrow$world space transformation matrix: $$M=T*R$$ then inverse (i.e. world$\rightarrow$object) of this transformation matrix is: $$M^{-1}=(T*R)^{-1}=R^{-1}*T^{-1}$$ So the order of multiplication of matrix inverses is reversed per matrix inversion rules.

| improve this answer | |
  • $\begingroup$ Sorry, maybe I was not clear in the question. Of course I know what you're explaining in your answer. I wanted to know why are we multiplying by $M^{−1}$ in one case and by $M$ in another. In which case do we use $M$ and in which case do we use $M^{−1}$? $\endgroup$ – nbro Oct 26 '16 at 11:13
  • $\begingroup$ Because $M$ transforms from one space to another (e.g. object$\rightarrow$world space), inverse of the matrix defines the opposite transformation (e.g. world$\rightarrow$object space) $\endgroup$ – JarkkoL Oct 26 '16 at 12:55
  • $\begingroup$ Ok, so let me try to be more specific: why $M$ (and not $M^{-1}$) transforms from object to world space? $\endgroup$ – nbro Oct 26 '16 at 12:58
  • $\begingroup$ It's natural to define how objects are oriented in the world rather than how world is oriented in objects. Mathematically nothing prevents you from defining $M$ as world$\rightarrow$object transform and use $M^{-1}$ to define object$\rightarrow$world transform though, it's just unnatural (: $\endgroup$ – JarkkoL Oct 26 '16 at 13:51
  • $\begingroup$ @nbro It might help to think of $M^{-1}$ as undoing whatever $M$ does. If you apply $M$ and then $M^{-1}$ you get back to where you started. So $M$ takes you from object to world, and $M^{-1}$ takes you from world to object. It doesn't matter what you call the matrix. Whatever you did to get from object to world, you have to do the opposite to get back from world to object. $\endgroup$ – trichoplax Oct 26 '16 at 17:16

The matrix contains a description to move form one space to another. The implied assumption is that there is some parent space which the matrix is defined in. There can be arbitrary chains of these parent child relationships. So you need to know the parent of the matrix.

The matrix multiplications $M \cdot \vec{v}$ describes the vector $\vec{v}$ in child space $M$ as seen by the parent space. The inverse $M^{-1} \cdot \vec{v}$ does the reverse of this it describes the vector in parent space in terms of child space coordinates.

So simply if you make a tree out of your parent child relationships when you move towards the root of your tree (World) you use non-inverted matrices, and when you move in the opposite direction (towards a leaf/child node) you take the inverse.

Why would you need the inverse? Well because you want to move two things independently of each other but still use the results in one space. For example imagine a world with one object and a camera. Its efficient to be able to model the camera separately. But then the vectors need to move form object space to camera space. So you take the object space move to world (moving towards root non inverted multiplication) and then you move that to camera space (move towards a child of world use inverse) so you get:

$$T_{camera}^{-1} \cdot (T_{object} \cdot \vec{v}) = T_{camera}^{-1} \cdot T_{object} \cdot \vec{v}$$

(Please note that matrix multiplication order depends on whether you define vector as row or column matrices. Both are fine mathematically as is storing the sub vectors in arbitrary order inside the matrix)

| improve this answer | |
  • $\begingroup$ Could you please point me to the right sources to read more about this parent-child relationships? I would like to understand this from the mathematical view point, if it makes sense, which I think it doesn't, because you talk about spaces in computer graphics in a different way than people in mathematics talk for example about vector spaces, that's I find this notation and terminology in computer graphics very ambiguous. $\endgroup$ – nbro Jan 19 '17 at 19:32
  • $\begingroup$ @nbro like i said it has nothing to do with mathematics. It has to do with practical use of modeling. Its only purpose is to make all vector spaces reachable by the computert so that you the user dont have to book keep all transforms separately. Why you would want the spaces in the first place is just a question of practicality. Its a tool to make the modeling easy. $\endgroup$ – joojaa Jan 19 '17 at 19:38
  • $\begingroup$ But then how can I imagine a space in computer graphics? Can I imagine it as being a coordinate system defined with respect to "something"? $\endgroup$ – nbro Jan 19 '17 at 19:40
  • $\begingroup$ @nbro its a relationship to the the previous entry in your model tree (not a binary tree just a tree like a filesystem or a xml file), where the root is the world that contains everything. $\endgroup$ – joojaa Jan 19 '17 at 19:43
  • $\begingroup$ By relationship I assume you're talking about transformations (matrix multiplications in practice), since at the very end this is exactly what happens. Are you saying that a space would be a transformation with respect to the previous "what"? Sorry for being so pedantic, but I just would like to make this thing clear, and after having read a lot of resources, no one has been able to really make this thing clear, but maybe I just didn't read the appropriate ones. $\endgroup$ – nbro Jan 19 '17 at 19:47

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.