From c00c8433cc7ed613b7b45bf96c88fbaeca81b6ba Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Mon, 15 Jan 2018 13:29:16 +0000 Subject: [PATCH] rayIntersection method checks for no hits --- fsl/data/mesh.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fsl/data/mesh.py b/fsl/data/mesh.py index 8fdab521d..a96864d9a 100644 --- a/fsl/data/mesh.py +++ b/fsl/data/mesh.py @@ -291,9 +291,12 @@ class TriangleMesh(object): return_locations=True, multiple_hits=False) + if tris.size == 0: + return np.zeros((0, 3)), np.zeros((0,)) + # sort by ray. I'm Not sure if this is # needed - does trimesh do it for us? - rayIdxs = np.argsort(rays) + rayIdxs = np.asarray(np.argsort(rays), np.int) locs = locs[rayIdxs] tris = tris[rayIdxs] -- GitLab