Skip to content
Snippets Groups Projects
Commit dfb76c87 authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

Unit test for nearestVertex

parent d1bac406
No related branches found
No related tags found
No related merge requests found
...@@ -254,7 +254,20 @@ def test_rayIntersection(): ...@@ -254,7 +254,20 @@ def test_rayIntersection():
assert np.all(np.isclose(loc, expected)) 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 loc.size == 0
assert tri.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)))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment