Search code examples
geometrypolygoncomputational-geometry

How to calculate the non-intersecting area of two polygons?


Is there an algorithm that can give me the area of the non-overlapping parts of two arbitrary polygons? I wasn't able to find anything that generalizes for two arbitrary polygons.


Solution

  • There is Vatti's clipping algorithm that works with arbitrary polygons and allows to find "xor" clipping polygon(s). Then you can calculate area of result.

    enter image description here

    This algorithm is used in Clipper library (opensource, has bindings to some programming languages)