Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to scale a shape made of points?

Say I have a shape like this:

larger shape

And I want to scale it down to this:

smaller shape

How do I calculate the location of the points (red circles) to do so?

like image 726
MiJyn Avatar asked Feb 17 '23 02:02

MiJyn


1 Answers

new.x = scale * (old.x - center.x) + center.x
new.y = scale * (old.y - center.y) + center.y

Repeat for each point.

like image 80
Mark Ransom Avatar answered Feb 23 '23 14:02

Mark Ransom