title: Generating Fractals with transformation matrices
body: <p>I'm trying to generate fractals using five different transformations that I have implemented from skeleton code, translate, rotate, scale, non-uniform scale, and image. These transformations are all 3x3 matrices, for example:</p>
  
  <pre><code>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;
  }
  </code></pre>
  
  <p>where Matrix is defined as </p>
  
  <pre><code>class Matrix
  {
      public:
      float data [ 3 ] [ 3 ];
  
      Matrix ( void )
      {
          int i, j;
  
          for ( i = 0; i &lt; 3; i++ )
          {
              for ( j = 0; j &lt; 3; j++ )
              {
                  data [ i ] [ j ] = 0;
              }
          }
      }
  };
  </code></pre>
  
  <p>In a test file, there is the following code that is supposed to generate <a href="https://www.google.com/url?sa=i&amp;rct=j&amp;q=&amp;esrc=s&amp;source=images&amp;cd=&amp;cad=rja&amp;docid=pmR6IznDB9jjXM&amp;tbnid=xgMYBw85f8qv9M%3a&amp;ved=0CAUQjRw&amp;url=https://www.zeuscat.com/andrew/chaos/sierpinski.html&amp;ei=_cgMU5-aJajf2QXWw4CAAw&amp;bvm=bv.61725948,d.aWc&amp;psig=AFQjCNE0_2jHvd4A3TTdS-666_6n6pBKrA&amp;ust=1393433211400826" rel="nofollow">Serpinski's Triangle</a></p>
  
  <pre><code>vector&lt;Matrix&gt; 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 );
  </code></pre>
  
  <p>Where Pt is defined as:</p>
  
  <pre><code>class Pt
  {
  public:
      float x, y;
  
      Pt ( float newX, float newY ) 
      { 
          x = newX;
          y = newY;
      }
  
      Pt ( void ) 
      { 
          x = y = 0;
      }
  };
  </code></pre>
  
  <p>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?</p>