diff --git a/Project.toml b/Project.toml index 60f3c1234..305d237d7 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeometryOps" uuid = "3251bfac-6a57-4b6d-aa61-ac1fef2975ab" authors = ["Anshul Singhvi and contributors"] -version = "0.1.7" +version = "0.1.8" [deps] CoordinateTransformations = "150eb455-5306-5404-9cee-2592286d6298" diff --git a/src/methods/clipping/difference.jl b/src/methods/clipping/difference.jl index 246ee55a7..604e4606b 100644 --- a/src/methods/clipping/difference.jl +++ b/src/methods/clipping/difference.jl @@ -161,7 +161,17 @@ function _difference( end local polys for (i, poly_b) in enumerate(GI.getpolygon(multipoly_b)) - polys = difference(i == 1 ? multipoly_a : GI.MultiPolygon(polys), poly_b; target, fix_multipoly) + #= Removing intersections of `multipoly_a`` with pieces of `multipoly_b`` - as + pieces of `multipolygon_a`` are removed, continue to take difference with new shape + `polys` =# + polys = if i == 1 + difference(multipoly_a, poly_b; target, fix_multipoly) + else + difference(GI.MultiPolygon(polys), poly_b; target, fix_multipoly) + end + #= One multipoly_a has been completly covered (and thus removed) there is no need to + continue taking the difference =# + isempty(polys) && break end return polys end