checkpoint
authoradam <adam@megacz.com>
Thu, 6 Dec 2007 05:19:32 +0000 (21:19 -0800)
committeradam <adam@megacz.com>
Thu, 6 Dec 2007 05:19:32 +0000 (21:19 -0800)
darcs-hash:20071206051932-5007d-9674d93b3bd91eab9831775565aa2f1890c64e1c.gz

src/edu/berkeley/qfat/Main.java
src/edu/berkeley/qfat/Mesh.java

index dac265b..1582d69 100644 (file)
@@ -51,9 +51,9 @@ public class Main extends MeshViewer {
         */
         float width  = (float)0.7;
         float depth  = (float)0.08;
-        float height = (float)0.35;
+        float height = (float)0.4;
 
-        float rshift = width/2;
+        float rshift =   width/2;
         float lshift = -(width/2);
 
         //float halfup = height/2;
@@ -65,7 +65,10 @@ 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(0,  depth,    halfup)),
+            new Matrix(new Vec(0, -depth,    halfup)),
+            */
             new Matrix(new Vec(lshift,       0,  height)),
             new Matrix(new Vec(rshift,       0,  height)),
             new Matrix(new Vec(lshift,       0, -height)),
@@ -76,6 +79,9 @@ public class Main extends MeshViewer {
 
         };
 
+        //   
+
+
 
         Point ltf = new Point(lshift,  (depth/2),  (height/2));
         Point mtf = new Point( 0.0,    (depth/2),  (height/2));
@@ -255,14 +261,15 @@ public class Main extends MeshViewer {
 
         Vec v;
         Matrix inv = p.errorQuadric();
-        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)300);
         if (p.quadric_count == 0) {
-            v = goal.nearest(p.p).p.minus(p.p).norm().times(1/(float)1000);
+            v = goal.nearest(p.p).p.minus(p.p).norm().times(1/(float)300);
         }
         Vec v2 = new Vec((random.nextFloat() - (float)0.5) / 500,
                         (random.nextFloat() - (float)0.5)  / 500,
                         (random.nextFloat() - (float)0.5)  / 500);
-        v = v.plus(v2.norm().times(1/(float)1000));
+        v = v.plus(v2.norm().times(1/(float)300));
+        //v = v2;
 
         boolean good = p.move(v);
 
@@ -275,7 +282,8 @@ public class Main extends MeshViewer {
         double delta = tile_delta + goal_delta;
         double swapProbability = Math.exp((-1 * delta) / temp);
         //boolean doSwap = good && (Math.random() < swapProbability);
-        boolean doSwap = good && (tile_delta <= 0 && goal_delta <= 0);
+        //boolean doSwap = good && (tile_delta <= 0 && goal_delta <= 0);
+        boolean doSwap = good && (tile_delta + goal_delta <= 0);
         if (doSwap) {
             tile_score = new_tile_score;
             goal_score = new_goal_score;
index e3a7cde..264e379 100644 (file)
@@ -239,15 +239,15 @@ public class Mesh implements Iterable<Mesh.T> {
                 else if (nearest_in_other_mesh == null) {
                     if (score_against != null) {
                         Vert ne = score_against.nearest(p);
-                        oldscore = ne.fundamentalQuadric().preAndPostMultiply(p) * 100 * 100;
+                        oldscore = ne.fundamentalQuadric().preAndPostMultiply(p) * 100 * 10;
                     } else {
                         oldscore = 0;
                     }
                 } else {
-                    oldscore = nearest_in_other_mesh.fundamentalQuadric().preAndPostMultiply(p) * 100 * 100;
+                    oldscore = nearest_in_other_mesh.fundamentalQuadric().preAndPostMultiply(p) * 100 * 10;
                 }
             } else {
-                oldscore = (quadric.preAndPostMultiply(p) * 100);
+                oldscore = (quadric.preAndPostMultiply(p) * 100) / quadric_count;
             }
 
             oldscore = oldscore;
@@ -265,11 +265,11 @@ public class Mesh implements Iterable<Mesh.T> {
                     aspects += e.t.aspect()*e.t.aspect();
                 }
                 */
-
+                /*
                 float minangle = (float)(Math.PI * 0.9);
                 if (ang > minangle)
                     oldscore += (ang - minangle);
-
+                */
                 e = e.pair.next;
             } while (e != this.e);
             if (numaspects > 0) oldscore += (aspects / numaspects);
@@ -471,7 +471,7 @@ public class Mesh implements Iterable<Mesh.T> {
                 return (float)(length()*Math.sqrt(t.area()));
             return length()*t.area();
             */
-            return length() + midpoint().distance(nearest.p);
+            return (float)Math.max(length(), midpoint().distance(nearest.p));
         }
         public int compareTo(E e) {
             return e.comparator() > comparator() ? 1 : -1;