# Is the statement in Scratchapixel about transforming points correct?

I am reading this lesson from scratchapixel. To my understanding (and the example given in the same website) M is the matrix that transforms from local to world.

Giong through the paragraph before figure 7, though, I get the following:

If we know the 4x4 matrix M that transforms a coordinate system A into a coordinate system B ...

Say A is the local coord system and B is the world coord system. Therefore M transforms from local to world.

... then if we transform a point whose coordinates are originally defined with respect to A with the inverse of M (...), we get the coordinates of P with respect to B.

We know, A = local coord system. The Plocal = local point coords are (-0.5, 0.5, -0.5). Then, as the quoted text says, we transform Plocal with the inverse of M to get the point w.r.t. to B = woorld coord system

However, this last operation (statement) confuses me, since the example they give the do Pworld = Plocal * M. But from the quoted text I understand that Pworld = inv(M) * Plocal

Can someone help me figuring out what am I missing? Is the wording of the text wrong?

• If M transforms from local to world, then pLocal * M = pWorld and pWorld * inv(M) = pLocal. These are the formulas stated on the page you linked. – Alexandre Desbiens Jun 29 '15 at 16:50
• Could you put a quote of the text passages you find confusing? Maybe, like you said, it's the wording, so someone here could formulate it with a different approach. – Alexandre Desbiens Jun 29 '15 at 16:54
• The texts passages are the two I quoted in my question. To me the example says Pworld = Plocal * M which is ok to me. However, the text quoted, seems (at least for me) saying Pworld = Plocal * inv(M), i.e. "If we transform a point P whose coords are defined w.r.t. to local-coord system with the inverse of M, we get the coords of P w.r.t. world-coord system" or paraphrasing "A point P in local-coord system, transformed with the inverse of M, gives the point P in woord-coord system". I think it should be "A point P in local-coord sys, transformed with M, gives the point P in woord-coord sys" – BRabbit27 Jun 29 '15 at 17:06
• But how do we convert a point or vertex from one coordinate system (such as the world coordinate space) to another [...]? This part seems to imply that in that paragraph, they inverted A and B so that A is world coordinates and B is local coordinates, to show how to convert world position to local position. – Alexandre Desbiens Jun 29 '15 at 17:12

Let's take a simple example with the following variables

A: Local-space coordinates system
B: World-space coordinates system
M: Transformation matrix from local-space to world-space (A -> B)


Let's say we have a point PA in local space. To get the values of PA in world coordinates, we need to apply the transformation M on it:

// Local to World: A -> B
PB = PA * M    // If you are using row-based positions (your case)
PB = M * PA    // If you are using column-based positions


You can apply the inverse transformation to get PA back from PB:

// World to local: B -> A
PA = PB * inv(M)    // If you are using row-based positions (your case)
PA = inv(M) * PB    // If you are using column-based positions


The website you linked in the question has a part on this. It talks briefly about transforming a point from world-space to local-space:

As suggested before, it is sometimes more convenient to operate on points when they are defined with respect to a local coordinate system rather than defined with respect to the world coordinate system. For instance, in the example of the cube (figure 6), defining the corners of the cube in local space is easier than in world space. But how do we convert a point or vertex from one coordinate system (such as the world coordinate space) to another (converting points from a coordinate system to another is a very common process in CG)? That's easy. If we know the 4x4 matrix M that transforms a coordinate system A into a coordinate system B, then if we transform a point whose coordinates are originally defined with respect to A [Should be B] with the inverse of M (we will explain next why we use the inverse of M rather than M), we get the coordinates of P with respect to B [Should be A].