MINIATURE / STUDY / LEVEL 2 OF 5

The shrinking
matrix.

The stage node carries one product of three matrices: T(spot) · S(1/12) · T(−origin). Written left to right, read right to left: a point on my body is first moved so that the floor under my head becomes the origin, then shrunk twelve times, then carried to the table. Scaling always happens about the origin, so the first step is what keeps the model from being thrown across the room. Step through it below, then try the wrong order.

T(−origin)the floor point under my head goes to (0, 0, 0)
→
S(1/12)every coordinate × 1/12, about that origin: my feet stay put
→
T(spot)the origin goes to the table top: my feet land on the spot

The room from the side

left is the far side of the table, right is where I stand

The matrix so far

The last step's matrix is exactly what miniatureMatrix(origin) returns; the page checks that and prints the result below the calculation.

The matrix, and the same product on a node

miniatureModel.js

miniatureMatrix builds the product with cg so it can be tested with numbers. placeMiniature issues the same factors as node calls. Clay's move, turnY and scale multiply on the right, so the calls are written in the same order as the matrices, left to right. faceMe adds a half turn between carrying and shrinking; the scene leaves it off.


      

Where it is used

miniature.js

The origin is taken once, the first frame there is a head, and kept. That is what lets the model walk: I move, the origin does not, so the difference is my step, shrunk. R clears it.


      
    

What you should be able to explain

  1. Right to left on the point. M · p applies the rightmost factor to p first. The code reads left to right because clay multiplies each new call on the right.
  2. Scale about a pivot. S always shrinks toward (0, 0, 0). Moving the pivot there first, and away afterwards, is the same trick Pocket City uses to zoom about its gold lot and the house uses to swing its door.
  3. Why the wrong order misses. Scaling first shrinks my distance from the room's centre as well as my body, and the later −origin then subtracts a full-size distance from a shrunk one. The error is exactly origin × (1 − 1/12).
  4. An origin that stays. If the origin were taken every frame, the model would stand on the spot forever and never walk.

Exercises: ① Stand 1.8 m from the table's centre and switch to the wrong order: how far from the spot does the model land, and does that match origin × 11/12? ② With faceMe on, between which two factors does the half turn sit, and why not before T(−origin)? ③ What single change makes the model 1/24 scale, and how tall is a 6 ft person's model then?