[examples] Use computed convex hull inertia in tetra.py
@@ -9,11 +9,11 @@ from siconos.mechanics.collision.tools import Contactor
from siconos.io.mechanics_io import Hdf5
import siconos.numerics as Numerics
import siconos.io.mechanics_io
+from siconos.mechanics.collision.convexhull import ConvexHull
options = siconos.mechanics.collision.bullet.SiconosBulletOptions()
options.worldScale = 1.0
-import pydoc
# Creation of the hdf5 file for input/output
with Hdf5() as io:
@@ -36,6 +36,10 @@ with Hdf5() as io:
collision_group1=1,
collision_group2=2)
+ # computation of inertia and volume
+ ch = ConvexHull(pts)
+ inertia,volume=ch.inertia(ch.centroid())
+
# The cube object made with an unique Contactor : the tetrahedron shape.
# As a mass is given, it is a dynamic system involved in contact
# detection and in the simulation. With no group id specified the
@@ -43,7 +47,7 @@ with Hdf5() as io:
io.addObject('cube', [Contactor('Tetra', collision_group=1)],
translation=[0, 0, 4],
velocity=[0, 0, 0, 0, 0, 0],
- mass=1)
+ mass=1, inertia=inertia)
# the ground object made with the ground shape. As the mass is
# not given, it is a static object only involved in contact
