2

This is a question that appears to be easy, but I'm having a hard time getting it to work properly.

I have a (nonconvex) polygon defined by a list of vertices. I would like to create another polygon, where every point is shifted outward by a certain amount. I tried scaling the points and then shifting back to the original origin, but that didn't have the effect I want.

screenshot

I would like for each point to be "outside" of the original point. But "outside" appears to be very difficult to compute, given only a list of points. Is there an easy way to do this?

Rick
  • 1,784
  • 3
  • 15
  • 25

2 Answers2

0

It seems that you want an offset of the polygon, that is, the set of all points that are outside the polygon and whose distance to the polygon is some given number. The offset is not a polygon, however,

Perhaps you could just scale all vertices with respect to the centroid of the polygon.

lhf
  • 70,581
  • 9
  • 108
  • 149
  • I think this (scale all vertices wrt centroid) is what I tried in the image above. Unless I'm doing something stupid, it doesn't result in all of the points being outside of the original points. – Rick Aug 15 '13 at 19:37
0

I think you're right that inside and outside are hard to define as a global property. But with each component line segment individually, there is a clear definition of left and right (at least, within the context of traversing the path).

So, I think if you traverse your segments counter-clockwise and add segments offset to the right of the current segment, this may be close to what you want. Or traverse clockwise and add segments offset to the left. It may create degenerate shapes at concavities.

luser droog
  • 18,988
  • 3
  • 53
  • 105