in contactopt/hand_object.py [0:0]
def calc_dist_contact(self, hand=True, obj=False, special_contact=False):
"""Set hand and object contact maps based on DiffContact method.
This is sometimes used when ground truth contact is not known"""
object_mesh = Meshes(verts=[torch.Tensor(self.obj_verts)], faces=[torch.Tensor(self.obj_faces)])
hand_mesh = Meshes(verts=torch.Tensor(self.hand_verts).unsqueeze(0), faces=torch.Tensor(self.closed_faces).unsqueeze(0))
hand_verts = torch.Tensor(self.hand_verts).unsqueeze(0)
if not special_contact:
obj_contact, hand_contact = calculate_contact_capsule(hand_verts, hand_mesh.verts_normals_padded(), object_mesh.verts_padded(), object_mesh.verts_normals_padded())
else:
# hand_verts_subdivided = util.subdivide_verts(hand_mesh.edges_packed().unsqueeze(0), hand_verts)
# hand_normals_subdivided = util.subdivide_verts(hand_mesh.edges_packed().unsqueeze(0), hand_mesh.verts_normals_padded())
hand_verts_subdivided = hand_verts
hand_normals_subdivided = hand_mesh.verts_normals_padded()
obj_contact, hand_contact = calculate_contact_capsule(hand_verts_subdivided, hand_normals_subdivided, object_mesh.verts_padded(),
object_mesh.verts_normals_padded(), caps_rad=0.003) # needed for paper vis?
if hand:
self.hand_contact = hand_contact.squeeze(0).detach().cpu().numpy()
if obj:
self.obj_contact = obj_contact.squeeze(0).detach().cpu().numpy()