Let me make this clear first:

this has almost nothing to do with transformation matrixes, except that they follow similar patters, and thus, can be interchanged.

Alright! onto the good part:

I wanted to make some way to do matrix math in AS3, so i built a simple class for it, and thought i might as well share. it supports the common matrix operations, addition, subtraction, multiplication, and inverses of 1x1, 2x2, and 3x3 matrices. This can be used for solving linear systems of equations, which may be useful.

here's a link:

http://pastebin.com/DSrfj3Lz

A small script i wrote up for testing is below. It solves a 3 variable system of equations with fairly good accuracy. ( To within math errors )

Code:

package
{
import ASUtil.Math.matrix;
import flash.display.Sprite;
public class Main extends Sprite
{
/*
1x - 3y + 3z = -4
2x + 3y - 1z = 15
4x - 3y - 1z = 19
The solution is ( 5, 1, -2 )
We solve this using an inverse matrix:
[ 1 -3 3 ] [ x ] [ -4 ]
[ 2 3 -1 ] * [ y ] = [ 15 ]
[ 4 -3 -1 ] [ z ] [ 19 ]
Gets turned into
[ 1 -3 3 ] ^ -1 [ -4 ] [ x ]
[ 2 3 -1 ] * [ 15 ] = [ y ]
[ 4 -3 -1 ] [ 19 ] [ z ]
Which should result in about
[ 5 ]
[ 1 ]
[ -2 ]
---------------------------------------------------------------
[ -4 ]
[ 15 ]
[ 19 ]
*/
private var m:matrix = new matrix ( 1, 3, -4, 15, 19 );
/*
[ 1 -3 3 ]
[ 2 3 -1 ]
[ 4 -3 -1 ]
*/
private var m2:matrix = new matrix ( 3, 3, 1, -3, 3, 2, 3, -1, 4, -3, -1 );
public function Main()
{
trace ( m2 );
trace ( m );
trace ( m2.inverse ().mulMatrix ( m ) );
}
}
}

:)