File gl_plot.py changed (mode: 100644) (index da5e578..7a3fa9a) |
... |
... |
class ConvexHull(gl.GLMeshItem): |
311 |
311 |
self.w.central_widget.addItem(self) |
self.w.central_widget.addItem(self) |
312 |
312 |
|
|
313 |
313 |
def recalculate(self): |
def recalculate(self): |
314 |
|
#č velmi krátko - ConvexHull rozmichá vzorky a nadělá ďupy |
|
315 |
|
sampled_plan_tri = getattr(self.w.sample_box, self.w.sample_box.tri_space) |
|
316 |
|
tree = spatial.cKDTree(sampled_plan_tri) |
|
317 |
|
self.points = self.w.sample_box.convex_hull.points |
|
318 |
|
dd, ii = tree.query(self.points, k=1, p=2) |
|
|
314 |
|
if (self.w.sample_box.nsim != len(self.w.sample_box.convex_hull.points)): |
|
315 |
|
#č ConvexHull nemichá vzorky a nedělá ďupy - byla to chyba v Blackboxu |
|
316 |
|
print(self.__class__.__name__ + \ |
|
317 |
|
": convex hull points mismatch. Switching to the failsafe code.") |
|
318 |
|
sampled_plan_tri = getattr(self.w.sample_box, self.w.sample_box.tri_space) |
|
319 |
|
tree = spatial.cKDTree(sampled_plan_tri) |
|
320 |
|
self.points = self.w.sample_box.convex_hull.points |
|
321 |
|
dd, ii = tree.query(self.points, k=1, p=2) |
|
322 |
|
|
|
323 |
|
self.simplices = self.w.sample_box.convex_hull.simplices |
|
324 |
|
box_facets = ii[self.simplices.flatten()].reshape(-1, 3) |
|
325 |
|
self.events = self.w.sample_box.get_events(box_facets) |
|
326 |
|
|
|
327 |
|
|
|
328 |
|
nodes_colors = np.empty((self.w.sample_box.nsim, 4)) |
|
329 |
|
nodes_colors[self.w.sample_box.failsi] = np.array([253, 93, 97, 0])/255 |
|
330 |
|
nodes_colors[~self.w.sample_box.failsi] = np.array([67, 255, 81, 0])/255 |
|
331 |
|
|
319 |
332 |
|
|
320 |
|
self.simplices = self.w.sample_box.convex_hull.simplices |
|
321 |
|
box_facets = ii[self.simplices.flatten()].reshape(-1, 3) |
|
322 |
|
self.events = self.w.sample_box.get_events(box_facets) |
|
|
333 |
|
self.vertex_colors = nodes_colors[ii] |
|
334 |
|
|
|
335 |
|
else: #č reabilitace ConvexHull |
|
336 |
|
self.points = self.w.sample_box.convex_hull.points |
|
337 |
|
self.simplices = self.w.sample_box.convex_hull.simplices |
|
338 |
|
self.events = self.w.sample_box.get_events(self.simplices) |
|
339 |
|
|
|
340 |
|
|
|
341 |
|
nodes_colors = np.empty((self.w.sample_box.nsim, 4)) |
|
342 |
|
nodes_colors[self.w.sample_box.failsi] = np.array([253, 93, 97, 0])/255 |
|
343 |
|
nodes_colors[~self.w.sample_box.failsi] = np.array([67, 255, 81, 0])/255 |
|
344 |
|
|
|
345 |
|
|
|
346 |
|
self.vertex_colors = nodes_colors |
323 |
347 |
|
|
324 |
348 |
|
|
325 |
|
nodes_colors = np.empty((self.w.sample_box.nsim, 4)) |
|
326 |
|
nodes_colors[self.w.sample_box.failsi] = np.array([253, 93, 97, 0])/255 |
|
327 |
|
nodes_colors[~self.w.sample_box.failsi] = np.array([67, 255, 81, 0])/255 |
|
328 |
|
|
|
329 |
349 |
|
|
330 |
|
self.vertex_colors = nodes_colors[ii] |
|
331 |
350 |
|
|
332 |
351 |
# marker |
# marker |
333 |
352 |
self.nsim = self.w.sample_box.nsim |
self.nsim = self.w.sample_box.nsim |
|
... |
... |
class Facets(gl.GLMeshItem): |
401 |
420 |
self.w.central_widget.addItem(self) |
self.w.central_widget.addItem(self) |
402 |
421 |
|
|
403 |
422 |
def recalculate(self): |
def recalculate(self): |
404 |
|
sampled_plan_tri = getattr(self.w.sample_box, self.w.sample_box.tri_space) |
|
405 |
423 |
self.points = self.w.sample_box.tri.points |
self.points = self.w.sample_box.tri.points |
406 |
424 |
|
|
407 |
425 |
self.simplices = self.w.sample_box.tri.simplices |
self.simplices = self.w.sample_box.tri.simplices |
|
... |
... |
class Wireframe(gl.GLMeshItem): |
486 |
504 |
self.w.central_widget.addItem(self) |
self.w.central_widget.addItem(self) |
487 |
505 |
|
|
488 |
506 |
def recalculate(self): |
def recalculate(self): |
489 |
|
sampled_plan_tri = getattr(self.w.sample_box, self.w.sample_box.tri_space) |
|
490 |
507 |
self.points = self.w.sample_box.tri.points |
self.points = self.w.sample_box.tri.points |
491 |
508 |
|
|
492 |
509 |
self.simplices = self.w.sample_box.tri.simplices |
self.simplices = self.w.sample_box.tri.simplices |