'Python: Fastest ray to mesh intersection?
hey guys is there a faster way to get the intersections between rays and a mesh than using trimesh in python?
So right now I am doing this approach: Stackoverflow: Python Intersections ray and mesh
Snippet of my code:
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)
But it is really slow for many rays.. Is there a faster way?
Solution 1:[1]
Have you installed pyembree as is metioned in ray.py?
requires numpy, but if you install `pyembree` you get the
same API with a roughly 50x speedup.
I am also working on the same problem these days, it is fast enough for me after I installed it.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | AlonOfficial5050 |
