findKNearest
Finds the k-nearest neighbors to a given query point within the KD-Tree.
This method performs a nearest-neighbor search in the KD-Tree structure to retrieve a list of the k closest items to the provided query point. The search uses the tree's spatial arrangement and allows for optional inclusion or exclusion of the query point itself.
Return
A list of the k nearest neighbors to the query point, ordered by proximity.
Parameters
query
The query point for which the k-nearest neighbors are to be found.
k
The number of nearest neighbors to retrieve.
includeQuery
If true, the query point itself can be included in the results. If false, the query point is excluded. Default is false.