X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMain.java;h=74f709837a7fb925652c73c629089434d270a6e9;hp=9cbffcf75cd6c7ea87bd14a43ee694f271b5bacb;hb=43e3ce680ac8b6d621bb59c0eed326d87e728a61;hpb=95776aa09a9b304bc7599b81699b595fdecd1f3a diff --git a/src/edu/berkeley/qfat/Main.java b/src/edu/berkeley/qfat/Main.java index 9cbffcf..74f7098 100644 --- a/src/edu/berkeley/qfat/Main.java +++ b/src/edu/berkeley/qfat/Main.java @@ -239,7 +239,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener Random random = new Random(); public synchronized void breakit() { - if (verts > 200) return; + if (verts > 400) return; //double min = (tile.avgedge/tile.numedges)*(1+(4/(double)verts)); //if (verts>0 && tile.es.peek().length() < min) return; PriorityQueue es = new PriorityQueue(); @@ -272,14 +272,14 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener Vec v = p.nearest_vert_in_other_mesh().minus(p.p).norm().times(r1); */ //v = p.norm().times(v.dot(p.norm())); - /* + Vec v = new Vec((random.nextFloat() - (float)0.5) / 1000, (random.nextFloat() - (float)0.5) / 1000, (random.nextFloat() - (float)0.5) / 1000); - */ + /* Matrix inv = p.errorQuadric(); Vec v = new Vec(inv.d, inv.h, inv.l).norm().times(1/(float)1000); - + */ boolean aspect = false;//(Math.abs(random.nextInt()) % 100) <= 2; Matrix old_tile_aspect = null;//goal.aspect; boolean good = true; @@ -297,16 +297,17 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener double new_tile_score = tile.score(); double new_goal_score = goal.score(); double tile_delta = new_tile_score - tile_score; - double goal_delta = new_goal_score - goal_score; + double goal_delta = 0;//new_goal_score - goal_score; double delta = tile_delta + goal_delta; double swapProbability = Math.exp((-1 * delta) / temperature); //boolean doSwap = Math.random() < swapProbability; boolean doSwap = good && (tile_delta <= 0 && goal_delta <= 0); + //boolean doSwap = true; //System.out.println(doSwap); if (doSwap) { tile_score = new_tile_score; goal_score = new_goal_score; - //System.out.println("score: " + tile_score + " / " + goal_score); + System.out.println("score: " + tile_score + " / " + goal_score); if (aspect) System.out.println("aspect " + v); } else { if (aspect) { @@ -466,6 +467,10 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener 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(); }