Scaling about an arbitrary point


The animated gif above shows the result of scaling an object about a point that is not the origin. This is like moving an object’s center and then scaling the object.

Here’s an ICE tree that scales an object (a cube in this example) about an arbitrary point.

I didn’t freeze the transforms on the cube, so I used a StaticKineState property to hold the initial SRT values. Otherwise, when I had the cube.kine.global plugged into the tree, I ended up with some weird results sometimes.

A null named “pivot_position” is used to specify the scaling point.

First, we translate the scaling point back to the origin of the cube coord system.
Then we apply the scaling, and then we translate back to the “pivot position”.
Because the cube transforms weren’t frozen, I then multiple by the cube’s initial transfo matrix to get the final result.
References:
On-Line Computer Graphics Notes