How can I create an internal spiral for a polygon?

核能气质少年 提交于 2019-11-28 01:27:17
Spektre

this task is extremly hard to do.

  1. need to have the boundary polygon you want to fill with spiral

    I think you have it already

  2. create new smaller polygon by shifting all lines inwards by the step.

    It is similar to create stroke line around polygon. Step is the screw width so at start of polygon it is 0 and on the end it is d

  3. remove invalid lines from the newly generated screw

    Some lines on corners and curvatures will intersect. This is very hard to detect/repair reliably see

  4. repeat (do next screw) ... until no space for screw found

    But now after the first screw the step is always d this will not necessarily fill the whole shape. For example if you have some thinner spot on shape it will be filled much more faster then the rest so there can still be some holes left.

    You should detect them and handle as you see fit see

    Be aware detection if the area is filled is also not trivial

This is how this approach looks like:

[Notes]

If you forget about the spiral and want fill the interior with a zig zag or similar pattern then this is not that hard.

Spiral filling makes a lot of hard geometric problems and if you are not skilled in geometry and vector math this task could be a too big challenge for beginner or even medium skilled programmer in this field to make it work properly. That is at least my opinion (as I done this before) so handle it as such.

I worked on something like this using offsets from the polgyon based on medial axis of Voronoi diagram. It's not simple. I can't share the code as it belongs to the company I worked for and it may not exactly fit your needs.

But here are some similar things I found by other people:

http://www.me.berkeley.edu/~mcmains/pubs/DAC05OffsetPolygon.pdf

http://www.cosy.sbg.ac.at/~held/teaching/seminar/seminar_2010-11/hsm.pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!