Search code examples
scalevertices

How to get correct vertices coordinates of scaled object?


So I have this object (abstract one)

enter image description here

I know all the coordinates (x, y) of black points (vertices) and the middle one. Now I want to scale it by a factor of 0.5 or 2.0 with the origin being the red point.

How do I get the new coordinates for the points for the Scaled object? Red would not change, left goes to left, right to right, etc... What is the formula or technique?

Any help greatly appreciated!


Solution

  • (x,y)=((x,y)-(redx,redy))*2+(redx,redy)