February 2019
Intermediate to advanced
292 pages
6h 55m
English
As you’ve seen, you can create transformation matrices to translate, scale, rotate, and skew. But what if you want to do more than one at a time?
It’s a completely reasonable expectation. Let’s say that you are (eventually) going to render a teapot. The model you’re rendering is at the origin and is small relative to the rest of the scene. The model is also tipped on its side. You’d like to rotate it so it’s right-side up, scale it to a reasonable size, and then translate it so it’s sitting on a table, instead of the floor.
You could apply each transformation in sequence, like this:
| | # rotate the teapot to be right-side up |
| | A ← rotation_x(π / 2) |
| | teapot ← A * teapot |
| | |
| | # next, make the teapot 5x larger |
| | B ← scaling(5, ... |
Read now
Unlock full access