From 298b0d6b3ee5f8a759544e22a1e7d2df8a134c58 Mon Sep 17 00:00:00 2001 From: robin Date: Tue, 4 Apr 2023 17:01:16 +0200 Subject: [PATCH] Fix interactive demos. --- .../demos/Armadillo/FC/Environment/ArmadilloInteractive.py | 4 ++-- examples/demos/Beam/FC/Environment/BeamInteractive.py | 2 +- examples/demos/Liver/FC/Environment/LiverInteractive.py | 2 +- examples/features/dataGeneration_single.py | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/demos/Armadillo/FC/Environment/ArmadilloInteractive.py b/examples/demos/Armadillo/FC/Environment/ArmadilloInteractive.py index 531fc298..76729249 100644 --- a/examples/demos/Armadillo/FC/Environment/ArmadilloInteractive.py +++ b/examples/demos/Armadillo/FC/Environment/ArmadilloInteractive.py @@ -90,7 +90,7 @@ def create(self): if sphere(pts, p_forces.centers[zone]) <= pow(p_forces.radius[zone], 2): self.areas[-1].append(i) # Create sphere at initial state - self.spheres_init.append(self.mesh_coarse.points(self.areas[-1]).mean(axis=0)) + self.spheres_init.append(self.mesh_coarse.points()[self.areas[-1]].mean(axis=0)) self.spheres.append(self.sphere(self.spheres_init[-1]).alpha(0.5)) # Define fixed plane @@ -166,7 +166,7 @@ def mouse_move(self, evt): if not self.interactive_window and self.selected is not None: # Compute input force vector - mouse_3D = self.plotter.compute_world_position(evt.picked2d) + mouse_3D = self.plotter.compute_world_coordinate(evt.picked2d) move_3D = (mouse_3D - self.spheres_init[self.selected]) / self.mouse_factor if np.linalg.norm(move_3D) > 2: move_3D = 2 * move_3D / np.linalg.norm(move_3D) diff --git a/examples/demos/Beam/FC/Environment/BeamInteractive.py b/examples/demos/Beam/FC/Environment/BeamInteractive.py index 7eac3b4d..2481a4f7 100644 --- a/examples/demos/Beam/FC/Environment/BeamInteractive.py +++ b/examples/demos/Beam/FC/Environment/BeamInteractive.py @@ -177,7 +177,7 @@ def mouse_move(self, evt): if not self.interactive_window and self.selected is not None: # Compute input force vector - mouse_3D = self.plotter.compute_world_position(evt.picked2d) + mouse_3D = self.plotter.compute_world_coordinate(evt.picked2d) move_3D = (mouse_3D - self.mesh_init[self.spheres_init[self.selected]]) / self.mouse_factor if np.linalg.norm(move_3D) > 10: move_3D = 10 * move_3D / np.linalg.norm(move_3D) diff --git a/examples/demos/Liver/FC/Environment/LiverInteractive.py b/examples/demos/Liver/FC/Environment/LiverInteractive.py index 66cc1013..e379fb4d 100644 --- a/examples/demos/Liver/FC/Environment/LiverInteractive.py +++ b/examples/demos/Liver/FC/Environment/LiverInteractive.py @@ -159,7 +159,7 @@ def mouse_move(self, evt): if not self.interactive_window and self.selected is not None: # Compute input force vector - mouse_3D = self.plotter.compute_world_position(evt.picked2d) + mouse_3D = self.plotter.compute_world_coordinate(evt.picked2d) move_3D = (mouse_3D - self.mesh_coarse.points()[self.spheres_init[self.selected]]) / self.mouse_factor if np.linalg.norm(move_3D) > 1.5: move_3D = 1.5 * move_3D / np.linalg.norm(move_3D) diff --git a/examples/features/dataGeneration_single.py b/examples/features/dataGeneration_single.py index f308c400..398e5ced 100644 --- a/examples/features/dataGeneration_single.py +++ b/examples/features/dataGeneration_single.py @@ -7,7 +7,6 @@ from DeepPhysX.Core.Pipelines.BaseDataGeneration import BaseDataGeneration from DeepPhysX.Core.Environment.BaseEnvironmentConfig import BaseEnvironmentConfig from DeepPhysX.Core.Database.BaseDatabaseConfig import BaseDatabaseConfig -# from DeepPhysX.Core.Visualization.VedoVisualizer import VedoVisualizer # Session related imports from Environment import MeanEnvironment