If I have a random polygon of any complexity, be it a square or an irregular 20 sided polygon, how can I scale this up?

I know the coordinates of each point on the polygon, but that is all.

Another requirement is that as the polygon is scaled up, each side must be an equal distance from its original smaller counterpart. Unlike if you were to directly upscale a rectangle for example, where two sides would be more distant than the other two.

Any help would be greatly appreciated, thanks.


You can see in the demonstration image below, the top rectangles are directly scaled, 1:1. I want to achieve the bottom rectangle scaling, keeping equal distance. How might it be possible to calculate the new x,y coords of the scaled up polygon?

enter image description here


I have been corrected, I should be referring to Polygon Offsetting (not scaling!).

  • $\begingroup$ Thanks @Minestrone. I've thrown on some more tags, if only my knowledge of mathematical terminology was better! At least I'm learning. $\endgroup$ Commented Jan 26, 2016 at 22:12
  • $\begingroup$ Do you have a picture of an example of what you have in mind? The bit about the rectangle is making me wonder what your version of a scaled up rectangle would even look like... $\endgroup$
    – pjs36
    Commented Jan 26, 2016 at 22:13
  • $\begingroup$ It sounds like what you want is impossible unless the polygon is regular or otherwise very symmetric. For a generic non-regular polygon (such as a rectangle that's not a square) it will be impossible to place a (non-trivially) scaled version of the polygon such that all sides are displaced by the same distance! $\endgroup$ Commented Jan 26, 2016 at 22:14
  • $\begingroup$ Hmmm, I understand your point regarding the symmetry. I have added a sample to demonstrate what I mean. $\endgroup$ Commented Jan 26, 2016 at 22:20
  • $\begingroup$ (Correction -- the criterion for being scalable-with-a-common-displacement is that the polygon has an inscribed circle. It doesn't need to be particularly symmetric for that, though. In particular it is always possible for a triangle). $\endgroup$ Commented Jan 26, 2016 at 22:20

1 Answer 1


This is called polygon offsetting rather than scaling.

In the general case, this is much harder than it seems, as different parts of the inflated polygon can overlap each other, letting holes appear, and some edges may completely disappear. The way to handle corners isn't so well defined either.

For an exact solution, have a look at Clipper.

For a simple solution not guaranteed to work on all shapes, you have to consider all vertices in turn, draw lines parallel to the abutting edges, at the desired distance on the right side, and find their intersection.

enter image description here

  • $\begingroup$ Thank you the term clarification Yves. I'm not sure Clipper will work out integrating into my code base, but I'll take a close look. Thanks! $\endgroup$ Commented Jan 26, 2016 at 22:29
  • $\begingroup$ @JoshKahane: the elementary solution might be enough for your needs. $\endgroup$
    – user65203
    Commented Jan 26, 2016 at 22:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .