AlexanderFabisch / distance3d

Distance computation and collision detection in 3D.
https://alexanderfabisch.github.io/distance3d/
Other
61 stars 8 forks source link

Compute potentials of tetrahedral mesh #56

Closed AlexanderFabisch closed 1 year ago

AlexanderFabisch commented 2 years ago

Example with MANO mesh:

Steps

from hand_embodiment.mano import HandState
import open3d as o3d
hs = HandState(left=False)
hs.recompute_mesh()
hs.pose[:] = np.array([0, 0, 0, 0, 0, 0.546, 0, 0, 0, 0, 0, 0.615, -0.4, 0.14, 0.546, 0, 0, 0.14, 0, 0, 0.683, -1.23, 0.34, 0.14, 0, -0.2, 0.2, 0.14, 0, 0.2, -0.888, 0.14, 0.478, 0, 0, 0.27, 0, 0, 0.478, 0.615, -0.478, 0.2, 0, 0, -0.273, 0, 0, 0.273])
o3d.io.write_triangle_mesh("mano.stl", mesh)
./TetWild mano.stl
gmsh -format vtk -save -o mano.vtk mano_.msh
python bin/compute_potentials.py test/data/mano.stl test/data/mano.vtk test/data/mano_potentials.json
vertices, tetrahedra = io.load_tetrahedral_mesh("test/data/mano.vtk")
with open("test/data/mano_potentials.json", "r") as f:
    potentials = np.asarray(json.load(f))
rigid_body1 = hydroelastic_contact.RigidBody(np.eye(4), vertices, tetrahedra, potentials)
rigid_body2 = hydroelastic_contact.RigidBody.make_sphere(np.array([-0.02, -0.035, 0.025]), 0.025, 2)
codecov-commenter commented 2 years ago

Codecov Report

Merging #56 (48ecab1) into master (e2b4cb6) will decrease coverage by 0.07%. The diff coverage is n/a.

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
- Coverage   94.62%   94.55%   -0.08%     
==========================================
  Files          43       43              
  Lines        4000     4000              
  Branches      510      510              
==========================================
- Hits         3785     3782       -3     
- Misses        143      146       +3     
  Partials       72       72              
Impacted Files Coverage Δ
distance3d/gjk/_gjk_jolt.py 93.56% <0.00%> (-0.88%) :arrow_down:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.