Closed amdshameer closed 4 months ago
Hello,
This line bothers me :
ray_direction = surface_point.reshape(1,3) - mesh.center_mass.reshape(1,3)
This ray has no reason to be the shortest path to the mesh (especially if it is not smooth).
I think you should look into trimesh.proximity.closest_point
instead of this ray-based approach. I also suggest to batch the surface_points
to improve the performances.
This would reduce your code to these three lines:
for mesh_idx, mesh in enumerate(meshes):
_, dist, _ = trimesh.proximity.closest_point(mesh, surface_points)
points_present_on_meshes[mesh_idx, dist < dist_threshold] = True
@Kiord Thank you for that suggestion!
@mikedh Thank you so much for a wonderful package! I need your suggestion on the following:
Currently, I am looping through all the meshes, and check if a distance threshold is reached for every point(obtained from some other process) that is closer to the mesh surface using RayMeshIntersector. I have 100 meshes, and the number points closer to the surface varies between (30,3) to (50,3). Is there any better and efficient way to do it instead of the code below?
trimesh version: 3.23.5 and python2.7