Link to home
Start Free TrialLog in
Avatar of moshecristel
moshecristel

asked on

Calculating corner points for rotated rectangle

I have a Rectangle object and I am trying to calculate where its four corner points would be if I were to rotate it counter-clockwise 45 degrees around its center.  Any ideas on an easy way to do this?
ASKER CERTIFIED SOLUTION
Avatar of Rezantis
Rezantis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of moshecristel
moshecristel

ASKER

This seems like a very good idea but I can't seem to quite get it to work.  AffineTransform's createTransformedShape method doesn't return a Polygon but a GeneralPath and I haven't yet figured out how to get the corner points out of that.  Any ideas?
This seems like a very good idea but I can't seem to quite get it to work.  AffineTransform's createTransformedShape method doesn't return a Polygon but a GeneralPath and I haven't yet figured out how to get the corner points out of that.  Any ideas?
I was finally able to use the PathIterator to get the corner points.  Thanks for the help.
Glad to help.  Sorry I didn't get back to you on the PathIterator bit; I was going to when I got home, then fell asleep when I got back from work.  ^^;