1

I need to create an outline of a 2d polygon (I do that by scaling the vertices along the average of the edge normal's). But there is a problem when handling concave polygons because of the possible self intersections.

packman outline(green: original shape,purple:outline,white lines: normal's)

I've tried to fix those self intersections via the benley-ottmann algorithm and discarding the smallest part, but that doesn't preserve the original shape very well.

packman outline fixed

So I would like to know if there is a way that preserves the original shape better?

Spektre
  • 49,595
  • 11
  • 110
  • 380
GTull
  • 13
  • 4
  • Your software must have a flaw, the "fixed" outline is not as expected. Overlap the two plots to see that. –  Jun 15 '20 at 20:34
  • see [draw outline for some connected lines](https://stackoverflow.com/a/22068534/2521214) – Spektre Jun 16 '20 at 07:27

1 Answers1

0

I would look into "polygon offsetting", the basic idea would be that for every vertex of the polygon you change that into a circle with a given radius, for every segment of the polygon you change that into a rectangle parallel to the original segment, and take the union of all resulting forms.