Skip to main content
GameDev.net gamedev.net
🔒 Locked

Rotating a rectangle

Started by Woody FX Jul 21, 2008 at 3:18 PM 1 replies 1.4k views
Original Post
Woody FX
Woody FX
Hi guys. Is there a simple way to rotate a rectangle and keep track of the coordinates of each of the corners? Say for example we had a rectangle whoes corners were (0,0) (0,10) (5,10) (5,0). And if we were to rotate the rectangle by 45degrees clockwise. Is there a simple way to use that data to generate the new coordinates of the corners? I'm working on a device with no fixed point or floating point support, but I can work around that if I got some general idea of how to approach the problem. Thannks -Woody
Schildpad
Schildpad
check this page http://en.wikipedia.org/wiki/Coordinate_rotation where it says "Two Dimensions"
Woody FX
Woody FX
Thank you Schildpad :)

So if i read it correctly to get the new coordinate of the rotated x coordinate
is :
x(cos of the angle to rotate) + y(sin of the angle to rotate)

Thanks again,
-Woody

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.