Scale coordinates

Started by
5 comments, last by jaysonturner 14 years, 1 month ago
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
Advertisement
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.
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
x' = (x-width/2)*factorX + width/2
y' = (y-height/2)*factorY + height/2

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

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Right, what about if the points don't make a rectangle, but another shape?
you can transform any coordinate like that it doesnt matter what shape the polygon has.
Sorry, I understand now, thanks guys.

Jayson

This topic is closed to new replies.

Advertisement