I have a concave polygon stored as an Area. How would I flip/invert/mirror the polygon about the y-axis?
+2
A:
You might try this (I'm assuming your Area object is named polygon):
polygon.transform(AffineTransform.getRotateInstance(0, 1))
The AffineTransform's getRotateInstance() static method returns a new AffineTransform object with a rotation around the vector <0, 1> (aka the Y-axis).
Peter Nix
2009-07-08 16:07:49
Just a sec.... doesn't this just rotate the image anticlockwise by 90 degrees?
Il-Bhima
2009-07-08 16:14:10
@Il-Bhim if you're polygon lies centered on the origin, the rotation about the y-axis will mirror the polygon, not actually move it around the coordinate system. If your polygon isn't on the origin, it will both mirror and move it.
Peter Nix
2009-07-08 16:17:39