
Ask HN: Algorithm for Calculating Contour of Polygons - 7532yahoogmail
This is something that&#x27;s central to PCB manufacture and surface mount soldering.<p>Given:<p><pre><code>  +------+
  |      |
  |     &#x2F;|--------+
  |    &#x2F; |        |
  |    | |        |
  |    \ |        |
  |     \|--------+
  |      |
  +------+
</code></pre>
The output would be:<p><pre><code>  +------+
  |      |
  |      +--------+
  |               |
  |               |
  |               |
  |      +--------+
  |      |
  +------+
</code></pre>
Where in general we can have lines, circles, ovals, and so on.<p>Now there are algorithms for extracting the contour if the input shapes are limited to rectangles. The goal is to generalize to arbitrary shapes.<p>Quadtrees + intersection + inside&#x2F;outside polygon computation could help. I&#x27;ve also read about the marching squares algo but that looks like it works on bit maps.
======
wizzerking
Does not the flood fill algorithm not work with this situation ??
[https://en.wikipedia.org/wiki/Flood_fill](https://en.wikipedia.org/wiki/Flood_fill)

Otherwise there is
[https://sourceforge.net/projects/polyclipping/](https://sourceforge.net/projects/polyclipping/)

