嘿,伙计们,有没有比在python中使用trimesh更快的方法来获得射线和网格之间的交叉点?
所以现在我在做这个方法:Stackoverflow: Python intersecsections ray and mesh
我的代码片段:import numpy as np
import trimesh
# load mesh
mesh = trimesh.load_mesh('test.ply')
# create some rays
ray_origins = np.load('origins.npy') # Shape = (100'000, 3)
ray_directions = np.array('directions.npy') #Shape = (100'000, 3)
# Get the intersections
locations, index_ray, index_tri = mesh.ray.intersects_location(
ray_origins=ray_origins, ray_directions=ray_directions)
但是对于许多光线来说,它真的很慢。有更快的方法吗?
您是否安装了ray.py中提到的pyembree ?
requires numpy, but if you install `pyembree` you get the
same API with a roughly 50x speedup.
这几天我也在做同样的问题,我安装了它之后,它对我来说已经足够快了。