I'm trying to figure out how to shrink a polygon using only the coordinates of its corners. For example, if I have the following shape with corners at
[(0, 0), (0, 100), (20, 100), (30, 60), (40, 100), (60, 100), (60, 0), (40, 10), (40, 40), (20, 40), (20, 10)] so the shape looks like this:
And I want to find the corner coordinates for if I shrink this polygon by some width and height factor. For example, If I want to shrink its width by 10% and height by 20% then this could be shown as something like this:
I originally asked this on StackOverflow, and it was suggested that this can be easily solved with analytic geometry. I don't know any analytic geometry, so I'm not sure where to start with solving this problem. Is there a straightforward way to do this?