Sign in to follow this  
jaysonturner

Scale coordinates

Recommended Posts

jaysonturner    102
Hi Everyone! I've got another question.. Say I have a rectangle made up of 4 points. I would like to know how to scale this rectangle from its center point to a given scale factor (whilst maintaining its proportions obv). How is this achievable... A link to the relevant Maths would grandly suffice. Kind Regards Jayson

Share this post


Link to post
Share on other sites
flery    186
calculate the center of the rectangle (width/2 , height/2). translate it so that the center ist 0,0. apply factor and translate it back.

Share this post


Link to post
Share on other sites
jaysonturner    102
Hi thanks for the quick reply,

The part I actually need help with is how to apply the factor... the raw method to take the point and scale them up or down.

Thanks
Jayson

Share this post


Link to post
Share on other sites
Buckeye    10747
x' = (x-width/2)*factorX + width/2
y' = (y-height/2)*factorY + height/2

Sounds like your factorX == factorY, and that's fine.

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