Generating Fractals with transformation matrices

I'm trying to generate fractals using five different transformations that I have implemented from skeleton code, translate, rotate, scale, nonuniform scale, and image. These transformations are all 3x3 matrices, for example:
Matrix rotate ( Pt p, float theta ) { Matrix rvalue; rvalue.data[0][0] = cos(theta); rvalue.data[0][1] = sin(theta); rvalue.data[0][2] = p.x + p.y*sin(theta)  p.x*cos(theta); rvalue.data[1][0] = sin(theta); rvalue.data[1][1] = cos(theta); rvalue.data[1][2] = p.y  p.y*cos(theta)  p.x*sin(theta); rvalue.data[2][0] = 0; rvalue.data[2][1] = 0; rvalue.data[2][2] = 1; return rvalue; }
where Matrix is defined as
class Matrix { public: float data [ 3 ] [ 3 ]; Matrix ( void ) { int i, j; for ( i = 0; i < 3; i++ ) { for ( j = 0; j < 3; j++ ) { data [ i ] [ j ] = 0; } } } };
In a test file, there is the following code that is supposed to generate Serpinski's Triangle
vector<Matrix> iat; iat.push_back ( scale ( Pt ( .9, .9 ), 0.5 ) ); iat.push_back ( scale ( Pt ( .9, .9 ), 0.5 ) ); iat.push_back ( scale ( Pt ( 0, .56 ), 0.5 ) ); setIATTransformations ( iat );
Where Pt is defined as:
class Pt { public: float x, y; Pt ( float newX, float newY ) { x = newX; y = newY; } Pt ( void ) { x = y = 0; } };
How should I implement setIATTransformations? Multiply the matrices until there is one transformation matrix and loop it a number of times to generate the fractal?
Answers(2)

you want sierpinski triangle or fractal generator driven by input script ?
1.triangle
 is easy enough
 no rotations translations or what so ever are needed
 just create the points according to sierpinski rule http://en.wikipedia.org/wiki/Sierpinski_triangle
 all sides of triangles are divided to half
 so the new points are just average of start and end point of each line
 and then fill the sub triangles
 if you want just wireframe then even the point list is not needed
2.generator
 you did not provide any rules,commands for the control script
 the only thing I see in your script is input of the 3 vertexes of the triangle
 and that is all
 I do not see any rule for triangle division
 or which part is filled or not
 how many recursions are used
 the only thing you mentioned was that you use 5 transformation matrices 3x3 for rotation,scale and translation
 but did not specify when and why

You will have to implement the chaos game. That is, you randomly select one of the transformations and apply it to the iteration point. Do it a number (30, 50 or 100) without painting the point and after that mark all the points. The resulting point cloud will in time fill the fractal.
Your operation scale( Pt (a,b), s) should realize the operation
(x',y')=s*(x,y)+(1s)*(a,b), that is, in matrix terms
 x'   s 0 (1s)*a  x   y'  =  0 s (1s)*b *  y   1   0 0 1   y 