Sign in to follow this  

Rotating a 2D rectangle, getting the centre

Recommended Posts

Hi, I have a rectangle defined as Vector v1, v2, v3, v4; (Where Vector is a simple x,y point). If I want to rotate the rectangle I need to find the centre of it, Vector vC = ...; // centre newX = cos(angle)*(v1.x-vC.x) - sin(angle)*(v1.y-vC.y) + vC.x; newy = sin(angle)*(v1.x-vC.x) + cos(angle)*(y1-y-vC.y) + vC.y; So, is my formula for the new x and y valid? and, if it is, how can I calculate the centre of the rectangle? Many thanks FFMG

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this