示例#1
0
    def onClickCalculate(self):
        if not self.LOCK_FLAG:
            self.LOCK_FLAG = True

            pObj = self.w.find_all()
            points = []
            for p in pObj:
                coord = self.w.coords(p)
                points.append((coord[0] + self.RADIUS, coord[1] + self.RADIUS))

            print(points)
            vp = Voronoi.Voronoi(points)
            vp.process()
            lines = vp.get_output()
            self.drawLinesOnCanvas(lines)

            print(lines)
import random
import time
import Voronoi as V

tab = []


def losowe(n):
    for i in range(n):
        x = random.randrange(-100, 100)
        y = random.randrange(-100, 100)
        tab.append((x, y))


losowe(100)
print(len(tab))
start = time.time()
vp = V.Voronoi(tab)
vp.process()
print(vp.get_output())

end = time.time()

print((end - start))