May 17, 2008

Affine Transformations in Actionscript

Rotations and reflections are easy enough with the Actionscript 3 Matrix class as long as you want a reflection whose mirror line passes through the origin, or a rotation about the origin.

However I recently was stumped with producing transformation matrices that included rotations about any point and reflection along any line. As there was little example code out there for this, I’ve decided to publish the two methods I’ve written to perform this. Both methods take the Matrix to set the transformation to as the first argument.