From: adam Date: Thu, 6 Dec 2007 00:49:49 +0000 (-0800) Subject: checkpoint X-Git-Url: http://git.megacz.com/?p=anneal.git;a=commitdiff_plain;h=23f01b5c0cdf4fa78e3b2582ad23648b55290586 checkpoint darcs-hash:20071206004949-5007d-90fa2d799287d94f4de4635b4d0287d170504359.gz --- diff --git a/src/edu/berkeley/qfat/Main.java b/src/edu/berkeley/qfat/Main.java index 7eb7b09..f2e3cc4 100644 --- a/src/edu/berkeley/qfat/Main.java +++ b/src/edu/berkeley/qfat/Main.java @@ -63,12 +63,6 @@ public class Main extends MeshViewer { new Matrix(new Vec(rshift, depth, halfup)), new Matrix(new Vec(lshift, -depth, halfup)), new Matrix(new Vec(rshift, -depth, halfup)), - /* - new Matrix(new Vec(lshift, depth, -halfup)), - new Matrix(new Vec(rshift, depth, -halfup)), - new Matrix(new Vec(lshift, -depth, -halfup)), - new Matrix(new Vec(rshift, -depth, -halfup)), - */ new Matrix(new Vec(lshift, 0, height)), new Matrix(new Vec(rshift, 0, height)), @@ -77,6 +71,7 @@ public class Main extends MeshViewer { new Matrix(new Vec( width, 0, 0)), new Matrix(new Vec(-width, 0, 0)), + }; @@ -249,19 +244,20 @@ public class Main extends MeshViewer { } public synchronized void rand(float temp, Mesh.Vert p) { - double tile_score = tile.score(); - double goal_score = goal.score(); //p.reComputeError(); p.reComputeErrorAround(); + double tile_score = tile.score(); + double goal_score = goal.score(); - Vec v = new Vec((random.nextFloat() - (float)0.5) / 400, - (random.nextFloat() - (float)0.5) / 400, - (random.nextFloat() - (float)0.5) / 400); + Vec v = new Vec((random.nextFloat() - (float)0.5) / 200, + (random.nextFloat() - (float)0.5) / 200, + (random.nextFloat() - (float)0.5) / 200); /* Matrix inv = p.errorQuadric(); - Vec v = new Vec(inv.d, inv.h, inv.l).norm().times(1/(float)1000); + v = new Vec(inv.d, inv.h, inv.l).norm().times(1/(float)1000); */ + boolean good = p.move(v); p.reComputeErrorAround(); @@ -302,7 +298,8 @@ public class Main extends MeshViewer { if (breaks) { breaks = false; breakit(); - gamma = 2; + gamma = 1; + //gamma = 2; //temp = last * 0.8f; //last = temp; //temp = hightemp; @@ -318,7 +315,8 @@ public class Main extends MeshViewer { gamma = 0.95f; } else { breakit(); - gamma = 2; + //gamma = 2; + gamma = 1; //temp = last * 0.8f; //last = temp; //temp = hightemp; diff --git a/src/edu/berkeley/qfat/Mesh.java b/src/edu/berkeley/qfat/Mesh.java index 46c2200..3696c0b 100644 --- a/src/edu/berkeley/qfat/Mesh.java +++ b/src/edu/berkeley/qfat/Mesh.java @@ -247,7 +247,7 @@ public class Mesh implements Iterable { oldscore = (quadric.preAndPostMultiply(p) * 100) / quadric_count; } - oldscore = oldscore*oldscore; + oldscore = oldscore; int numaspects = 0; float aspects = 0; @@ -260,12 +260,13 @@ public class Mesh implements Iterable { aspects += e.t.aspect()*e.t.aspect(); } - if (ang > Math.PI * 0.8) - oldscore += (ang - (Math.PI*0.8)) * 10; + float minangle = (float)(Math.PI * 0.3); + if (ang > minangle) + oldscore += (ang - minangle); e = e.pair.next; } while (e != this.e); - if (numaspects > 0) oldscore += (aspects / numaspects); + //if (numaspects > 0) oldscore += (aspects / numaspects); //System.out.println(oldscore); //oldscore = oldscore*oldscore; @@ -793,11 +794,11 @@ public class Mesh implements Iterable { public boolean has(Vert v) { return v1()==v || v2()==v || v3()==v; } public void glVertices(GL gl) { - + /* if (e1().bind_to.set.size() == 0) return; if (e2().bind_to.set.size() == 0) return; if (e3().bind_to.set.size() == 0) return; - + */ norm().glNormal(gl); p1().glVertex(gl); p2().glVertex(gl); diff --git a/src/edu/berkeley/qfat/MeshViewer.java b/src/edu/berkeley/qfat/MeshViewer.java index 96680be..fdbb1c7 100644 --- a/src/edu/berkeley/qfat/MeshViewer.java +++ b/src/edu/berkeley/qfat/MeshViewer.java @@ -168,7 +168,7 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi green -= .12f; blue -= .15f; - if (triangles) switch(t.color/*class*/) { + if (triangles) switch(t.colorclass) { case 0: gl.glColor4f((float)0.25, (float)0.25, (float)0.75, (float)0.3); break; case 1: gl.glColor4f((float)0.25, (float)0.75, (float)0.25, (float)0.3); break; case 2: gl.glColor4f((float)0.75, (float)0.25, (float)0.25, (float)0.3); break;