checkpoint
[anneal.git] / src / edu / berkeley / qfat / MeshViewer.java
index cb21cfb..96680be 100644 (file)
@@ -16,6 +16,7 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
     public Mesh.Vert[] points;
 
 
     public Mesh.Vert[] points;
 
 
+    public boolean breaks = false;
     boolean alt = false;
     boolean shift = false;
     boolean control = false;
     boolean alt = false;
     boolean shift = false;
     boolean control = false;
@@ -30,6 +31,7 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
             case KeyEvent.VK_CONTROL: control = true; break;
             case KeyEvent.VK_ALT: alt = true; break;
             case KeyEvent.VK_SHIFT: shift = true; break;
             case KeyEvent.VK_CONTROL: control = true; break;
             case KeyEvent.VK_ALT: alt = true; break;
             case KeyEvent.VK_SHIFT: shift = true; break;
+            case KeyEvent.VK_SPACE: breaks = true; break;
         }
     }
     public void keyReleased(KeyEvent e) {
         }
     }
     public void keyReleased(KeyEvent e) {
@@ -182,6 +184,7 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
                 t.glVertices(gl);
                 gl.glEnd();
             } else {
                 t.glVertices(gl);
                 gl.glEnd();
             } else {
+                /*
                 gl.glDisable(GL.GL_LIGHTING);
                 gl.glBegin(GL.GL_LINES);
                 gl.glColor3f(1, 1, 1);
                 gl.glDisable(GL.GL_LIGHTING);
                 gl.glBegin(GL.GL_LINES);
                 gl.glColor3f(1, 1, 1);
@@ -193,6 +196,7 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
                 t.e3().p2.p.glVertex(gl);
                 gl.glEnd();
                 gl.glEnable(GL.GL_LIGHTING);
                 t.e3().p2.p.glVertex(gl);
                 gl.glEnd();
                 gl.glEnable(GL.GL_LIGHTING);
+                */
             }
 
             Point centroid = t.centroid();
             }
 
             Point centroid = t.centroid();
@@ -205,10 +209,15 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
 
             if (mesh==goal)
                 for(Mesh.Vert p : new Mesh.Vert[] { t.v1(), t.v2(), t.v3() }) {
 
             if (mesh==goal)
                 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);
+                gl.glDisable(GL.GL_LIGHTING);
+                gl.glBegin(GL.GL_LINES);
+                gl.glColor3f(1, 1, 1);
+                p.p.glVertex(gl);
+                //p.p.plus(p.norm().times(p.score())).glVertex(gl);
+                if (p.nearest_in_other_mesh != null) p.nearest_in_other_mesh.p.glVertex(gl);
                     //tile.nearest(p).centroid().glVertex(gl);
                     //tile.nearest(p).centroid().glVertex(gl);
+                gl.glEnd();
+                gl.glEnable(GL.GL_LIGHTING);
                 }
 
             gl.glEnd();
                 }
 
             gl.glEnd();
@@ -222,10 +231,6 @@ public class MeshViewer implements GLEventListener, MouseListener, MouseMotionLi
         glcanvas = new GLCanvas();
         glcanvas.addGLEventListener(this);
         f.add(glcanvas, BorderLayout.CENTER);
         glcanvas = new GLCanvas();
         glcanvas.addGLEventListener(this);
         f.add(glcanvas, BorderLayout.CENTER);
-        f.pack();
-        f.show();
-        f.setSize(900, 900);
-        f.doLayout();
         glcanvas.addMouseListener(this);
         glcanvas.addMouseMotionListener(this);
         glcanvas.addMouseWheelListener(this);
         glcanvas.addMouseListener(this);
         glcanvas.addMouseMotionListener(this);
         glcanvas.addMouseWheelListener(this);