/// <summary> /// Find all items that are within a certain distance of an item /// </summary> /// <param name="_item">The item to find close other items for</param> /// <param name="_maxDistance">The maximum distance from _item to include</param> /// <returns> /// An enumeration of objects that are closer than _distance to _item /// </returns> public IEnumerable <T> FindClose(T _item, double _maxDistance) { if (ExploredNodes != null) { ExploredNodes.Clear(); } var closest = new ClosestObjects <T>(_maxDistance); FindNearest(_item, 0, 0, closest); return(closest.GetClosestObjects()); }
/// <summary> /// Find the nearest N elements in the KD Tree to the specified element. /// </summary> /// <param name="_item">The item to search for</param> /// <param name="_count">The number of closest elements to return</param> /// <returns> /// An enumeration of the closest N elements to the item specified /// </returns> public IEnumerable <T> FindNearest(T _item, int _count) { if (ExploredNodes != null) { ExploredNodes.Clear(); } var closest = new ClosestObjects <T>(_count); FindNearest(_item, 0, 0, closest); return(closest.GetClosestObjects()); }