def convolute(self, pattern): spoly = [] for pat in self.polygons: spoly.append([[int(self.scaling * p[0]), int(self.scaling * p[1])] for p in pat]) #Pyclipper spattern = [[int(self.scaling * p[0]), int(self.scaling * p[1])] for p in pattern] output = pyclipper.MinkowskiSum2(spattern, spoly, True) result = PolygonGroup(scaling=self.scaling, precision=self.precision, zlevel=self.zlevel) result.polygons = [] for poly in output: if len(poly) > 0: output_poly = [[ float(x[0]) / self.scaling, float(x[1]) / self.scaling, self.zlevel ] for x in poly] result.addPolygon(output_poly) return result
def test_minkowski_sum2(self): solution = pyclipper.MinkowskiSum2(PATTERN, [PATH_SIGMA], False) self.assertGreater(len(solution), 0)
def test_minkowski_sum2(self): with self.assertWarns(DeprecationWarning): pyclipper.MinkowskiSum2(PATTERN, [PATH_SIGMA], False)