0
\$\begingroup\$

I've been reading this very nice tutorial on OpenGL, and I encountered a statement which I can't wrap my head around. In Chapter 6, it states:

Transformation from one space to another ultimately means this: taking the basis vectors and origin point from the original coordinate system and re-expressing them relative to the destination coordinate system. The transformation matrix from one space to another contains the basis vectors and origin of the original coordinate system, but the values of those basis vectors and origin are relative to the destination coordinate system.

This is reaffirmed in Chapter 7:

... And this makes sense; a transformation matrix contains the basis vector and origin of the source space, as expressed in the destination coordinate system.

... But isn't it the other way around?

Take a look at this example from the tutorial:

Translation

The transformation Matrix to transform from the space on the left to the space on the right is

[1   0   0   1  ]
[0   1   0  -1.5]
[0   0   1   0  ]
[0   0   0   1  ]

The last column of the transformation matrix is the origin of the destination space, expressed relative to the source space.

What am I missing?

Note The above transformation matrix is not from the notes, so feel free to correct it.

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

The transformation Matrix to transform from the space on the left to the space on the right is

[1   0   0   1  ]
[0   1   0  -1.5]
[0   0   1   0  ]
[0   0   0   1  ]

Well this is not correct, the matrix you have shown is actually to transform any point from the space on the right to the space on the left. The correct matrix to transform from the space on the left to the right is actually

[1   0   0  -1  ]
[0   1   0  1.5 ]
[0   0   1   0  ]
[0   0   0   1  ]

Think about it like this. The [0,0] point on the left figure is actually [-1,1.5] relative to the new space (right figure), remember when you change a basis it's easier to think about it as actually transforming basis not the points, meaning you're actually representing the same points relative to a different basis.

Even though you can think of it the other way around, as of actually taking the inverse transform of the points, it's actually easier to think about it as transforming the basis, either way pick a convention and stick with it. You can also check my other answer, for better explanation of spaces.

\$\endgroup\$
4
  • \$\begingroup\$ thanks for the answer. When you think about it as transforming the basis, it's very clear. But when you say that the matrix in the question represents the "inverse transform of the points", that's what I don't see. For example, the point (0.5, 2.5) on the top of the left triangle becomes (1.5, 1.0) on the right (in the "global" space), which means that it was translated by [1, -1.5], not the inverse of that. Could you elaborate on that point? \$\endgroup\$ Commented Dec 10, 2014 at 16:31
  • \$\begingroup\$ First lets be clear that the basis on the right figure are the red blue lines. Your confusion comes from the fact that you moved the triangle along with basis. A change of basis doesn't move the triangle its exactly like looking at the triangle from different perspective the triangle stays at the same position but with different interpretation of its coordinates \$\endgroup\$
    – concept3d
    Commented Dec 10, 2014 at 17:15
  • \$\begingroup\$ Took me a while, but I just got it (after some reading), and your answer was very helpful! If I'm not mistaken, what the author is trying to explain is not moving the triangle from the image on the left to the right, but rather, transforming the coordinate system of the triangle on the right from its object space to the destination space \$\endgroup\$ Commented Dec 11, 2014 at 13:56
  • \$\begingroup\$ @Nasser Glad to help. \$\endgroup\$
    – concept3d
    Commented Dec 11, 2014 at 13:59

You must log in to answer this question.

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