| 165 | self.update() |
| 166 | |
| 167 | def initPoints(self): |
| 168 | t = time() |
| 169 | self.points.clear() |
| 170 | # 创建点 |
| 171 | stepX = self.width() / 20 |
| 172 | stepY = self.height() / 20 |
| 173 | for x in range(0, self.width(), int(stepX)): |
| 174 | for y in range(0, self.height(), int(stepY)): |
| 175 | ox = x + random() * stepX |
| 176 | oy = y + random() * stepY |
| 177 | point = Point(ox, ox, oy, oy) |
| 178 | point.valueChanged.connect(self.update) |
| 179 | self.points.append(point) |
| 180 | print(time() - t) |
| 181 | |
| 182 | t = time() |
| 183 | # 每个点寻找5个闭合点 |
| 184 | findClose(self.points) |
| 185 | print(time() - t) |
| 186 | |
| 187 | def animate(self, painter): |
| 188 | for p in self.points: |