baddstats / polyclip

R package polyclip: a port of the Clipper library for polygon geometry
19 stars 6 forks source link

A Reduce-like interface to polyclip() #6

Open thomasp85 opened 6 years ago

thomasp85 commented 6 years ago

I often need to combine multiple shapes, e.g. following a triangulation. With the current API it is only possible to combine two polygons in one go, and I'll end up writing something like

Reduce(function(a, b) {
  polyclip(a, b, op = 'union')
}, polygons)

With many polygons to merge this loop will become a bottleneck and it would be nice if polyclip exposed this api more efficiently...

One idea would be to check if B is NULL and if that is the case then just perform the clipping operation successively on the elements of A

baddstats commented 5 years ago

I am now working on this. Sorry for delay.