1
\$\begingroup\$

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?

\$\endgroup\$
4
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 29, 2015 at 16:50
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 29, 2015 at 16:54
  • \$\begingroup\$ 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" \$\endgroup\$
    – BRabbit27
    Commented Jun 29, 2015 at 17:06
  • \$\begingroup\$ 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. \$\endgroup\$ Commented Jun 29, 2015 at 17:12

1 Answer 1

1
\$\begingroup\$

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].

I have added comments in square brackets ([]) for clarity.

NOTE: P with respect to A is PA, and P with respect to B is PB. X in respect to/of Y is a point X in the base Y: Coordinate vectors

But this part is slightly unclear because in this paragraph there are some typos inverting the letters. Just ignore this passage, the rest of the article seems mathematicaly accurate.

\$\endgroup\$
2
  • \$\begingroup\$ I see it clear now, so there were actually typos in the paragraph. With the comments you added looks pretty much to what I was understanding with the example provided. \$\endgroup\$
    – BRabbit27
    Commented Jun 29, 2015 at 18:46
  • \$\begingroup\$ I passed that information on to the guys form the website. If you don't contact them directly to report that sort of typo, it's not very useful for the next people who will read the same content ;-))). \$\endgroup\$
    – user18490
    Commented Jul 5, 2015 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .