Basic HTML version of Foils prepared 13 July 98

Foil 62 Rotation About the Origin

From Java Academy II:Advanced Java NPAC/ECS Java Academy -- February to April 98. by Tom Scavo


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



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998