To rotate a polygon about the origin, we simply rotate each vertex: for ( int i = 0; i < npoints; i++ ) { x = xpoints[i]; y = ypoints[i]; q = new DrawablePoint( x, y ); q.rotate( theta ); xpoints[i] = q.x; ypoints[i] = q.y; } |
The variables npoints, xpoints[], and ypoints[] are from the Polygon class |