private PointSet<Vert> pointset = new PointSet<Vert>();
public Vert nearest(Point p) { return pointset.nearest(p); }
- private HashMap<Point,Vert> verts = new HashMap<Point,Vert>();
public Iterable<E> edges() {
return
}
}
- public Vert register(Point p) { Vert v = verts.get(p); return v==null ? new Vert(p) : v; }
+ public Vert register(Point p) { Vert v = pointset.get(p); return v==null ? new Vert(p) : v; }
public final class Vert extends HasPoint {
public Point p;
public Point getPoint() { return p; }
private Vert(Point p) {
this.p = p;
- if (verts.get(p) != null) throw new Error();
- verts.put(this.p, this);
+ if (pointset.get(p) != null) throw new Error();
pointset.add(this);
}
public void reinsert() {
// FIXME: screws up hashmap
unscore();
try {
- if (verts.get(this.p)==null) throw new Error();
- verts.remove(this.p);
+ if (pointset.get(this.p)==null) throw new Error();
pointset.remove(this);
float newx = m.a*p.x + m.b*p.y + m.c*p.z + m.d;
float newy = m.e*p.x + m.f*p.y + m.g*p.z + m.h;
this.p = new Point(newx, newy, newz);
// FIXME: what if we move onto exactly where another point is?
pointset.add(this);
- verts.put(this.p,(Vert)this);
} catch (Exception e) {
throw new RuntimeException(e);
}