done.add(p);
p.rescore();
}
+ /*
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdremove();
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdinsert();
+ */
return (float)(dist/num);
}
this.p = p;
if (verts.get(p) != null) throw new Error();
verts.put(this.p, this);
+ pointset.add(this);
+ }
+ public void reinsert() {
+ pointset.remove(this);
+ pointset.add(this);
}
public void kdremove() {
if (!inserted) return;
watch = score_against.nearest(po.p);
// don't attract to vertices that face the other way
- if (watch.norm().dot(norm()) < 0) {
+ if (watch.e == null || watch.norm().dot(norm()) < 0) {
watch = null;
} else {
watch.watch_x += po.p.x;
try {
if (verts.get(this.p)==null) throw new Error();
verts.remove(this.p);
+ 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;
float newz = m.i*p.x + m.j*p.y + m.k*p.z + m.l;
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);