开发者

outline vectorshape algorithm

consider the red 开发者_如何学编程line to be given as a sequence of points

outline vectorshape algorithm

I'm looking for an algorithm to create the outlines of the thick black shape (also as a sequence of points) such that they are ordered cleanly. And the outline should also respect a minimum distance to itself.

What algorithm can I use to achieve this?


You will need two types of offsetting algorithms:

  1. Offset a curve in both directions to produce a track
  2. Offset a closed curve inwards to produce one or more smaller closed polygons.

Let r be the distance to the red line, and b the desired thickness of the wall between the black lines/tracks.

  • Offset the red line by r using algorithm 1. This may produce a track which overlaps itself, i.e. has "blob-like" areas.
  • Offset the red line inwards using algorithm 2. Use binary search to find the distance d at which the shape splits in two or disappears. If d > b, then offset inwards by d - b to produce the second area. Otherwise the algorithm fails.
  • Subtract the second area from the first.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜