public synchronized void rand(double temperature, Mesh.Vert p) {
double tile_score = tile.score();
double goal_score = goal.score();
- p.rescore();
+ p.applyQuadricToNeighbor();
Vec v = new Vec((random.nextFloat() - (float)0.5) / 1000,
(random.nextFloat() - (float)0.5) / 1000,
}
breakit();
repaint();
- goal.unscoreAll();
+ goal.unApplyQuadricToNeighborAll();
repaint();
tile.recomputeAllFundamentalQuadrics();
repaint();
- goal.rescoreAll();
+ goal.applyQuadricToNeighborAll();
}
}
}
}
- public void unscoreAll() {
+ public void unApplyQuadricToNeighborAll() {
HashSet<Vert> done = new HashSet<Vert>();
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) {
if (done.contains(p)) continue;
done.add(p);
- p.unscore();
+ p.unApplyQuadricToNeighbor();
}
}
public void recomputeAllFundamentalQuadrics() {
p.recomputeFundamentalQuadric();
}
}
- public float rescoreAll() {
+ public float applyQuadricToNeighborAll() {
int num = 0;
double dist = 0;
HashSet<Vert> done = new HashSet<Vert>();
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() }) {
if (done.contains(p)) continue;
done.add(p);
- p.rescore();
+ p.applyQuadricToNeighbor();
}
return (float)(dist/num);
}
public void recomputeFundamentalQuadric() {
- unscore();
+ unApplyQuadricToNeighbor();
Matrix m = Matrix.ZERO;
E e = this.e;
do {
e = e.pair.next;
} while(e != this.e);
fundamentalQuadric = m;
- rescore();
+ applyQuadricToNeighbor();
}
- public void unscore() {
+ public void unApplyQuadricToNeighbor() {
if (nearest_in_other_mesh == null) return;
if (fundamentalQuadric == null) return;
nearest_in_other_mesh.unsc();
score -= oldscore;
oldscore = 0;
}
- public void rescore() {
+ public void applyQuadricToNeighbor() {
if (score_against == null) return;
- unsc();
-
- if (nearest_in_other_mesh != null) unscore();
+ if (nearest_in_other_mesh != null) unApplyQuadricToNeighbor();
if (nearest_in_other_mesh == null) {
nearest_in_other_mesh = score_against.nearest(p);
nearest_in_other_mesh.resc();
}
}
-
+ unsc();
resc();
}
public void resc() {
/** does NOT update bound pairs! */
public boolean transform(Matrix m) {
- unscore();
+ unApplyQuadricToNeighbor();
try {
if (pointset.get(this.p)==null) throw new Error();
pointset.remove(this);
} catch (Exception e) {
throw new RuntimeException(e);
}
- rescore();
+ applyQuadricToNeighbor();
// should recompute fundamental quadrics of all vertices sharing a face, but we defer...
// FIXME: intersection test needed?