Skip to content

Commit

Permalink
Fix interactive demos.
Browse files Browse the repository at this point in the history
  • Loading branch information
RobinEnjalbert committed Apr 4, 2023
1 parent e62f2c3 commit 298b0d6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/demos/Beam/FC/Environment/BeamInteractive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion examples/demos/Liver/FC/Environment/LiverInteractive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion examples/features/dataGeneration_single.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 298b0d6

Please sign in to comment.