mymesh.tree.KDtreeNode.query_knn#

KDtreeNode.query_knn(x, k=1)[source]#

Find the k-nearest neighbor points in the tree to a point. Note: This currently only works for a point cloud tree (e.g. created with Points2KDtree())

Parameters:
  • x (np.ndarray) – Point coordinates (shape=(2,) or shape=(3,))

  • k (int, optional) – Number of nearest neighbor points to identify, by default 1

Returns:

  • dist (np.ndarray) – Array of distance between x and the nearest neighbors (shape=(k,))

  • coordinates (np.ndarray) – Array of coordinates for the nearest neighbor points (shape=(k,3))