Esempio n. 1
0
 def union(self, other, triedReversed=False, buf=0):
     poly = toPolygon(other)
     if not poly:
         return super().union(other, triedReversed)
     union = polygonUnion((self.polygons, poly), buf=buf)
     orientation = VectorField.forUnionOf((self, other))
     return PolygonalRegion(polygon=union, orientation=orientation)
Esempio n. 2
0
 def unionAll(regions, buf=0):
     regs, polys = [], []
     for reg in regions:
         if reg != nowhere:
             regs.append(reg)
             polys.append(toPolygon(reg))
     if not polys:
         return nowhere
     if any(not poly for poly in polys):
         raise RuntimeError(f'cannot take union of regions {regions}')
     union = polygonUnion(polys, buf=buf)
     orientation = VectorField.forUnionOf(regs)
     return PolygonalRegion(polygon=union, orientation=orientation)