checkpoint
[anneal.git] / src / edu / berkeley / qfat / Main.java
index 2a1584e..3ce1d88 100644 (file)
@@ -52,6 +52,7 @@ import edu.berkeley.qfat.geom.Polygon;
 
 public class Main extends InteractiveMeshViewer {
 
+
     public static int verts = 1;
 
     public static final Random random = new Random();
@@ -135,8 +136,7 @@ public class Main extends InteractiveMeshViewer {
 
     public Main(JFrame f) { super(f); }
 
-    public void fixupTile() { 
-        synchronized(safeTriangles) {
+    public synchronized void fixupTile() { 
         for(Matrix m1 : transforms) {
             for(Matrix m2 : transforms) {
                 if (m1==m2) continue;
@@ -199,7 +199,6 @@ public class Main extends InteractiveMeshViewer {
         tile.error_against = goal;
         goal.error_against = tile;
         fixupGoal();
-        }
     }
 
     public void breakit() {
@@ -236,8 +235,7 @@ public class Main extends InteractiveMeshViewer {
         Vec v = new Vec(random.nextFloat(), random.nextFloat(), random.nextFloat());
         v = v.norm().times((random.nextFloat() - 0.5f) * max);
         Matrix m = Matrix.translate(v);
-
-        boolean good = p.move(m, false);
+        boolean good = p.move(v, false);
         if (!good) { return false; }
 
         double new_tile_error = tile.error();
@@ -263,7 +261,7 @@ public class Main extends InteractiveMeshViewer {
             hits++;
             p.goodp = p.p;
         } else {
-            p.move(Matrix.translate(v.times(-1)), true);
+            p.move(v.times(-1), true);
             misses++;
         }
         p.reComputeErrorAround();
@@ -280,13 +278,7 @@ public class Main extends InteractiveMeshViewer {
         double acceptance = 1;
         while(true) {
             synchronized(this) {
-            synchronized(safeTriangles) {
-                safeTriangles.clear();
-                for(Mesh.T t : tile) 
-                    if (t.shouldBeDrawn())
-                        safeTriangles.add(t);
-            }
-            if (!anneal) { repaint(); Thread.sleep(10); continue; }
+                if (!anneal) { repaint(); Thread.sleep(10); continue; }
 
             double ratio = (hits+misses==0) ? 1 : (hits / (hits+misses));
             hits = 0;
@@ -371,9 +363,7 @@ public class Main extends InteractiveMeshViewer {
         }
         public void actionPerformed(ActionEvent event) {
             synchronized(Main.this) {
-                synchronized(safeTriangles) {
                     hit();
-                }
             }
         }
         public void hit() {}
@@ -863,6 +853,7 @@ public class Main extends InteractiveMeshViewer {
                         Matrix.translate(new Vec(-0.2f,0,0))
                         .times(Matrix.rotate(new Vec(1,0,0), (float)(-1*Math.PI/2))),
 
+
                         //Matrix.rotate(new Vec(0,0,1), (float)(1*Math.PI/2)),
 
                         /*