package edu.berkeley.qfat.geom;
import java.util.*;
+/** a set of points, plus many useful methods operating over the set */
public class PointSet<V extends HasPoint> implements Iterable<V> {
private RTree<V> rtree = new RTree<V>();
return exact.get(p);
}
- public void rebuild() {
- }
-
public void add(V v) {
V x = get(v.getPoint());
if (x != null && x.equals(v)) return;
exact.remove(p);
}
- public V nearest(Point p) {
+ public V nearest(Point p) { return nearest(p, null); }
+ public V nearest(Point p, Visitor<V> vis) {
if (exact.size()==0) return null;
- return rtree.nearest(p);
+ return rtree.nearest(p, vis);
}
public Vec diagonal() {
return new Vec(max_x - min_x, max_y - min_y, max_z - min_z);
}
+ // FEATURE: compute incrementally?
public Point centroid() {
float min_x = Float.MAX_VALUE;
float min_y = Float.MAX_VALUE;