0

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?

Gian Alessio
  • 95
  • 1
  • 9

1 Answers1

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.