
#include <math.h>

#include "RotatePoly.h"



RotatePoly::RotatePoly( Poly *a, float cx, float cy, float r )
{
  Poly();

  float x, y, xx, yy;

  r *= -3.14159*2;

  float s = sin( r );
  float c = cos( r );

  begin( );
  a->firstPoint( );

  while( a->nextPoint( &x, &y ) )
  {
    x -= cx;
    y -= cy;

    xx = x * c + y * s;
    yy = y * c - x * s;

    addPoint( xx+cx, yy+cy );
  }

  end();
}
