# Scale coordinates

## Recommended Posts

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 on other sites
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 on other sites
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 on other sites
x' = (x-width/2)*factorX + width/2
y' = (y-height/2)*factorY + height/2

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

##### Share on other sites
Right, what about if the points don't make a rectangle, but another shape?

##### Share on other sites
you can transform any coordinate like that it doesnt matter what shape the polygon has.

##### Share on other sites
Sorry, I understand now, thanks guys.

Jayson