【问题标题】:Python: Fastest ray to mesh intersection?Python:最快的光线到网格相交?
【发布时间】:2022-03-23 16:36:00
【问题描述】:

嘿伙计们,有没有比在 python 中使用 trimesh 更快的方法来获得光线和网格之间的交点?

所以现在我正在使用这种方法: Stackoverflow: Python Intersections 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)

但是对于很多光线来说真的很慢..有更快的方法吗?

【问题讨论】:

    标签: python raytracing trimesh


    【解决方案1】:

    您是否按照ray.py 中的说明安装了pyembree

    requires numpy, but if you install `pyembree` you get the
    same API with a roughly 50x speedup.
    

    这几天我也在解决同样的问题,安装后对我来说已经足够快了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-02-29
      • 2017-10-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多