void update(Object box) { float d = _boxer.getDistanceSquared(box,_point); if (d<_cutoff) { BoxDistance bd = new BoxDistance(box,d); if (_full) _set.remove(_set.last()); _set.add(bd); _full = _full || _k==_set.size(); if (_full) _cutoff = _set.last().distance; } } float[] point() {
/** * Returns the distance-squared from specified box to a point. */ float distanceSquared(Object box, float[] point) { if (box instanceof Node) { return ((Node)box).distanceSquared(point); } else { return _boxer.getDistanceSquared(box,point); } }