public void transform(Matrix m) {
ArrayList<Vertex> set = new ArrayList<Vertex>();
for(Vertex v : vertices) set.add(v);
- for(Vertex v : set) v.transform(m);
+ for(Vertex v : set) v.transform(m.times(v.p));
}
public void rebuild() { /*vertices.rebuild();*/ }
}
/** does NOT update bound pairs! */
- public boolean transform(Matrix m) {
+ public boolean transform(Point newp) {
if (immutableVertices) throw new Error();
unApplyQuadricToNeighbor();
vertices.remove(this);
for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
if (e.t != null) e.t.removeFromRTree();
- this.p = m.times(this.p);
+ this.p = newp;
for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
if (e.t != null) e.t.addToRTree();
vertices.add(this);
}
}
+ Point oldp;
public boolean move(Vec v) {
Matrix m = Matrix.translate(v);
boolean good = true;
- for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
- good &= p.transform(m);
+ for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to) {
+ p.oldp = p.p;
+ good &= p.transform(m.times(p.p));
+ }
for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
if (good)
p.reComputeErrorAround();
else
- p.transform(Matrix.translate(v.times(-1)));
+ p.transform(p.oldp);
return good;
}