Understanding 3D matrix transforms
Translation, Scaling, Rotation, and Skewing?!
In elementary school, we are taught translation, rotation, re-sizing/scaling, and reflection. The first three are used heavily in computer graphics — and they’re done using matrix multiplication.
If you’ve ever done a 2D or 3D game’s UI, you might have encountered transformations. Tutorials elsewhere describe them very superficially — they don’t dive into the mathematics on which those concepts were built. That works if you’re building fairly simple applications. At one point, it becomes necessary to just know it.
Here, I’m going to describe how transformations apply to points (and then objects) in a coordinate space.
Redefining points & vectors to fit our needs
A simple set of rules can help in reinforcing the definitions of points and vectors:
- In a n-dimensional space, a point can be represented using ordered pairs/triples.
- A vector can be added to a point to get another point.
- Similarly, the difference of two points can be taken to get a vector.
- A vector can be “scaled”, e.g. multiplied by a scalar to increase or decrease its magnitude. If that scalar is negative, then it will be flipped and will be…