// rotate to align major axis -- this probably needs to be done by a human.
goal.transform(new Matrix(new Vec(0, 0, 1), (float)(Math.PI/2)));
-
float goal_width = goal.diagonal().dot(new Vec(1, 0, 0));
float goal_height = goal.diagonal().dot(new Vec(0, 1, 0));
float goal_depth = goal.diagonal().dot(new Vec(0, 0, 1));
//tx.e3.shatter();
- tile.bind();
+ tile.rebindPoints();
//mid.move(new Vec((float)0,0,(float)-0.05));
//ltn.move(new Vec((float)0,0,(float)-0.05));
}
public synchronized void breakit() {
- if (verts > 200) return;
+ if (verts > 50) return;
PriorityQueue<Mesh.E> es = new PriorityQueue<Mesh.E>();
for(Mesh.E e : tile.edges()) es.add(e);
for(int i=0; i<10; i++) {
verts++;
System.out.println("shatter " + e);
e.shatter();
- tile.unbind();
- tile.bind();
+ tile.rebindPoints();
}
}
}
}
-
public static int verts = 0;
+
public void anneal() throws Exception {
int verts = 0;
while(true) {
- //Thread.sleep(10);
- for(int i=0; i<1; i++) {
+ HashSet<Mesh.Vert> hs = new HashSet<Mesh.Vert>();
+ for(Mesh.Vert p : tile.vertices()) hs.add(p);
+ for(int i=0; i<10; i++) {
repaint();
- //tile.ts.get(Math.abs(random.nextInt()) % tile.ts.size()).e1().p1
- for(Mesh.T t : tile)
- for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) {
- rand(10,p);
- }
- goal.unscore();
- tile.unscore();
- goal.fundamental();
- tile.fundamental();
- goal.rescore();
- tile.rescore();
+ for(Mesh.Vert v : hs) rand(10,v);
}
breakit();
+ repaint();
+ goal.unscoreAll();
+ repaint();
+ tile.recomputeAllFundamentalQuadrics();
+ repaint();
+ goal.rescoreAll();
}
-
}
public static void main(String[] s) throws Exception {