MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / BVH

Class BVH

python/pymesh/aabb_tree.py:44–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42 return sq_dists.squeeze(), segment_indices.squeeze(), closest_pts
43
44class BVH:
45 available_engines = PyMesh.BVHEngine.available_engines
46
47 def __init__(self, engine_name="auto", dim=3):
48 self.__raw_bvh = PyMesh.BVHEngine.create(engine_name, dim)
49
50 def load_data(self, vertices, faces):
51 self.__raw_bvh.set_mesh(vertices, faces)
52 self.__raw_bvh.build()
53
54 def load_mesh(self, mesh):
55 self.__raw_bvh.set_mesh(mesh.vertices, mesh.faces)
56 self.__raw_bvh.build()
57
58 def lookup(self, pts):
59 sq_dists, face_indices, closest_pts = self.__raw_bvh.lookup(pts)
60 return sq_dists.squeeze(), face_indices.squeeze(), closest_pts
61
62 def lookup_signed(self, pts, fn, vn, en, emap):
63 signed_dists, face_indices, closest_pts, face_normals = self.__raw_bvh.lookup_signed(pts, fn, vn, en, emap)
64 return signed_dists, face_indices.squeeze(), closest_pts, face_normals.squeeze()
65
66
67def distance_to_mesh(mesh, pts, engine="auto", bvh=None):

Callers 5

distance_to_meshFunction · 0.85
signed_distance_to_meshFunction · 0.85
map_vertex_attributeFunction · 0.85
map_face_attributeFunction · 0.85
map_corner_attributeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected