X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2FMain.java;h=9cbffcf75cd6c7ea87bd14a43ee694f271b5bacb;hb=95776aa09a9b304bc7599b81699b595fdecd1f3a;hp=b774066000443e5e9cb28c6922b12f1e56006e14;hpb=b6875b8bd79c804e15eb75bc64044ca2c770b07d;p=anneal.git diff --git a/src/edu/berkeley/qfat/Main.java b/src/edu/berkeley/qfat/Main.java index b774066..9cbffcf 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 > 300) return; + if (verts > 200) return; //double min = (tile.avgedge/tile.numedges)*(1+(4/(double)verts)); //if (verts>0 && tile.es.peek().length() < min) return; PriorityQueue es = new PriorityQueue(); @@ -257,17 +257,28 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener public synchronized void rand(double temperature, Mesh.Vert p) { double tile_score = tile.score(); double goal_score = goal.score(); - p.rescore(); + + /* //if (p.watch==null) return; float r1 = Math.abs(random.nextFloat()); r1 = r1 - (float)Math.floor(r1); r1 = r1 * (float)0.01; r1 = r1 - (float)0.005; + public Vert partner() { return quadric==null ? this : quadric; } + public Point quadric() { return quadric_count==0 ? partner().p : + new Point(quadric_x/quadric_count, quadric_y/quadric_count, quadric_z/quadric_count); } 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; @@ -291,6 +302,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener double swapProbability = Math.exp((-1 * delta) / temperature); //boolean doSwap = Math.random() < swapProbability; boolean doSwap = good && (tile_delta <= 0 && goal_delta <= 0); + //System.out.println(doSwap); if (doSwap) { tile_score = new_tile_score; goal_score = new_goal_score; @@ -412,7 +424,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) { p.p.glVertex(gl); //p.plus(p.norm().times(p.score()*10)).glVertex(gl); - p.partner().p.glVertex(gl); + //p.partner().p.glVertex(gl); //tile.nearest(p).centroid().glVertex(gl); }