Skip to content

Commit 7a01cdb

Browse files
committed
add test_Point3dTree_knn
1 parent 3d3d21c commit 7a01cdb

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/test_core/test_PyGe/test_Point3d.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,19 @@ def test_Point3dArray_sort(self):
8989
assert pnts[0] != Ge.Point3d(1, 1, 1)
9090
pnts.sortByDistFrom(Ge.Point3d(0, 0, 0))
9191
assert pnts[0] == Ge.Point3d(1, 1, 1)
92+
93+
def test_Point3dTree_knn(self):
94+
pnts = Ge.Point3dArray()
95+
for x in range(10):
96+
for y in range(10):
97+
for z in range(10):
98+
pnts.append(Ge.Point3d(x, y, z))
99+
100+
tree = Ge.Point3dTree(pnts)
101+
idxs , _ = tree.knnSearch(Ge.Point3d(0.4, 0.4, 0.4),1)
102+
assert pnts[0] == pnts[idxs[0]]
103+
104+
idxs , _ = tree.knnSearch(Ge.Point3d(10.4, 10.4, 10.4),1)
105+
assert pnts[999] == pnts[idxs[0]]
106+
107+

0 commit comments

Comments
 (0)