/** * Finds the node which is closest to 'target' * * @param target A point * @return Closest node or null if none is within the minimum distance. */ @Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
/** * Finds the node which is closest to 'target' * * @param target A point * @return Closest node or null if none is within the minimum distance. */ @Override public KdTree.Node findNeighbor(P target) { if( tree.root == null ) return null; this.target = target; this.closest = null; this.bestDistanceSq = maxDistanceSq; stepClosest(tree.root); return closest; }
stepClosest(nearer); if( dx2 <= bestDistanceSq ) { if( closest == null || dx2 < bestDistanceSq ) stepClosest(further);
stepClosest(nearer); if( dx2 <= bestDistanceSq ) { if( closest == null || dx2 < bestDistanceSq ) stepClosest(further);