Matrix binding = Matrix.ONE;
Vertex bound_to = this;
- private boolean good;
+ private boolean illegal = false;
public Point getPoint() { return p; }
public float error() { return olderror; }
vertices.add(this);
}
- public void reinsert() { vertices.remove(this); vertices.add(this); }
+ public void reinsert() {
+ vertices.remove(this);
+ vertices.add(this);
+ for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) e.t.reinsert();
+ }
public float olderror = 0;
public void setError(float nerror) {
if (immutableVertices) throw new Error();
unApplyQuadricToNeighbor();
-
this.p = newp;
- for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) e.t.reinsert();
reinsert();
-
applyQuadricToNeighbor();
if (ignoreProblems) return true;
- good = true;
+ illegal = false;
+ checkLegality();
+ return !illegal;
+ }
+
+ public void checkLegality() {
for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next) {
- if (Math.abs(e.crossAngle()) > (Math.PI * 0.9) || Math.abs(e.next.crossAngle()) > (Math.PI * 0.9)) good = false;
- if (e.t.aspect() < 0.1) good = false;
+ if (Math.abs(e.crossAngle()) > (Math.PI * 0.9) || Math.abs(e.next.crossAngle()) > (Math.PI * 0.9)) illegal = true;
+ if (e.t.aspect() < 0.1) illegal = true;
e.p2.quadricStale = true;
}
- if (good) triangles.range(oldp, this.p, (Visitor<T>)this);
- return good;
+ if (illegal) triangles.range(oldp, this.p, (Visitor<T>)this);
}
public void reComputeErrorAround() {
if (o instanceof Vertex)
return ((Vertex)o).e != null && ((Vertex)o).norm().dot(Vertex.this.norm()) >= 0;
T t = (T)o;
- if (!good) return false;
+ if (illegal) return false;
for(E e = Vertex.this.e; e!=null; e=e.pair.next==Vertex.this.e?null:e.pair.next) {
- if (!t.has(e.p1) && !t.has(e.p2) && e.intersects(t)) { good = false; }
+ if (!t.has(e.p1) && !t.has(e.p2) && e.intersects(t)) { illegal = true; }
if (e.t != null) {
- if (!e.t.has(t.e1().p1) && !e.t.has(t.e1().p2) && t.e1().intersects(e.t)) { good = false; }
- if (!e.t.has(t.e2().p1) && !e.t.has(t.e2().p2) && t.e2().intersects(e.t)) { good = false; }
- if (!e.t.has(t.e3().p1) && !e.t.has(t.e3().p2) && t.e3().intersects(e.t)) { good = false; }
+ if (!e.t.has(t.e1().p1) && !e.t.has(t.e1().p2) && t.e1().intersects(e.t)) { illegal = true; }
+ if (!e.t.has(t.e2().p1) && !e.t.has(t.e2().p2) && t.e2().intersects(e.t)) { illegal = true; }
+ if (!e.t.has(t.e3().p1) && !e.t.has(t.e3().p2) && t.e3().intersects(e.t)) { illegal = true; }
}
}
- return good;
+ return !illegal;
}
public boolean move(Matrix m, boolean ignoreProblems) {