diff --git a/tests/test_mesh.py b/tests/test_mesh.py index b38ccf8c18ab36cfa5c357e219453bd341433987..57e184065a4df06aea3ca2a8a6ca44e6fab03d68 100644 --- a/tests/test_mesh.py +++ b/tests/test_mesh.py @@ -254,7 +254,20 @@ def test_rayIntersection(): assert np.all(np.isclose(loc, expected)) - loc, tri = mesh.rayIntersection([[-1, -1, -1]], [[-1, -1, -1]]) + loc, tri = mesh.rayIntersection([[-2, -2, -2]], [[-1, -1, -1]]) assert loc.size == 0 assert tri.size == 0 + + +def test_nearestVertex(): + + verts = np.array(CUBE_VERTICES) + triangles = np.array(CUBE_TRIANGLES_CCW) + mesh = fslmesh.TriangleMesh(verts, triangles) + + nverts, nidxs, ndists = mesh.nearestVertex(verts * 2) + + assert np.all(np.isclose(nverts, verts)) + assert np.all(np.isclose(nidxs, np.arange(len(verts)))) + assert np.all(np.isclose(ndists, np.sqrt(3)))