Basic HTML version of Foils prepared 13 July 98

Foil 63 Yet Another rotate Method

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

The DrawablePolygon Class
1 We're finally ready to show how to rotate a polygon about an arbitrary point: public DrawablePolygon rotate( double theta, Point p ) { int x, y; DrawablePoint q; this.translate( -p.x, -p.y ); // rotate each vertex as in the previous foil this.bounds = null; this.translate( p.x, p.y ); return this; }

in Table To:


© 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