5

I have a 2D polygon that I want to shrink by a specific offset (A) to match a certain area ratio (R) of the original polygon. Is there a formula or algorithm for such a problem? I am interested in a simple solution for a triangle/quad but also a solution for complex polygons.

I attached an image for explanation. The original polygon is offset by A (equal-distant for each edge). A has to be chosen so that the new polygon has a specific area. In this example it should have half the area of the initial polygon.

enter image description here

timkado
  • 1,922
  • 2
  • 17
  • 27

1 Answers1

1

Your question is very nonspecific, but here is one way to do what you are looking for, assuming I understand what you are asking. Note that this may cause an undesirable offset in position which you will have to deal with in some way. Not knowing what point you want to scale the polygon about, these solutions assume the simplest circumstances.

The reason for the square root in all of these formulas is that area tends to change with the square of linear scaling, just as volume does with the cube of linear scaling.

For general polygon:

A = sqrt(R)
for each point in polygon:
    point.x := point.x * A
    point.y := point.y * A

For circle:

A = sqrt(R)
circle.radius := circle.radius * A

For rectangle in terms of width and height:

A = sqrt(R)
rect.w := rect.w * A
rect.h := rect.h * A
Void Star
  • 2,401
  • 4
  • 32
  • 57
  • Thanks for your reply. I attached an image to be more specific. – timkado Nov 27 '13 at 00:44
  • 1
    The problem you show in that picture is somewhat difficult to solve because some polygons may end up being segmented into two or more separate shapes. Let me think on it for a bit. – Void Star Nov 27 '13 at 00:47