Search code examples
algorithmpolygonclipping

Polygon created by subtracted polygons


Sample polygon and its illustrated holes

Above is a polygon (gray area) where I subtracted 4 polygons (red, green, purple, and blue areas). Is there a way to get the vertices of the created sub-polygon (small gray polygon)?

Sample polygon, holes removed

The polygons can be of any shape. Also, the side subtracted polygon can lie on the side of the main polygon (that's why I did not call it hole).


Solution

  • You want to look into clipping algorithms like Vatti. Or may be you want some port or binding of gpc.