checkpoint
[anneal.git] / src / Main.java
index e97f975..4e4dc86 100644 (file)
@@ -18,7 +18,6 @@ public class Main implements GLEventListener {
 
     public Main(StlFile stlf) {
 
-
         Geom.P ltf = geom.newP(-0.2,  0.1,  0.1);
         Geom.P mtf = geom.newP( 0.0,  0.1,  0.1);
         Geom.P rtf = geom.newP( 0.2,  0.1,  0.1);
@@ -97,16 +96,25 @@ public class Main implements GLEventListener {
 
                     if ((t1.p1().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) &&
                         (t1.p2().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) &&
-                        (t1.p3().plus(v).minus(t2.p2()).mag() < Geom.EPSILON))
-                        t1.bind(t2, 0);
+                        (t1.p3().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) {
+                        t1.e1().bind(t2.e3().pair);
+                        t1.e2().bind(t2.e2().pair);
+                        t1.e3().bind(t2.e1().pair);
+                    }
                     if ((t1.p2().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) &&
                         (t1.p3().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) &&
-                        (t1.p1().plus(v).minus(t2.p2()).mag() < Geom.EPSILON))
-                        t1.bind(t2, 1);
+                        (t1.p1().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) {
+                        t1.e2().bind(t2.e3().pair);
+                        t1.e3().bind(t2.e2().pair);
+                        t1.e1().bind(t2.e1().pair);
+                    }
                     if ((t1.p3().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) &&
                         (t1.p1().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) &&
-                        (t1.p2().plus(v).minus(t2.p2()).mag() < Geom.EPSILON))
-                        t1.bind(t2, 2);
+                        (t1.p2().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) {
+                        t1.e3().bind(t2.e3().pair);
+                        t1.e1().bind(t2.e2().pair);
+                        t1.e2().bind(t2.e1().pair);
+                    }
                 }
             }
         }
@@ -119,20 +127,28 @@ public class Main implements GLEventListener {
         //mid.move(geom.new V((float)-0.05,0,0));
 
         //mtf.move(geom.new V(0, (float)-0.05, (float)0.05));
+
+
+        for(Geom.T t : geom) {
+            t.e1().dobind();
+            t.e2().dobind();
+            t.e3().dobind();
+        }
+
         mtf.move(geom.new V(0, (float)-0.05, (float)0.00));
 
-        /*
 
+        /*
         for(int i=0; i<stlf.coordArray.length; i+=3) {
             Geom.P p0 = geom.newP(stlf.coordArray[i+0].x * MAG, stlf.coordArray[i+0].y * MAG, stlf.coordArray[i+0].z * MAG);
             Geom.P p1 = geom.newP(stlf.coordArray[i+1].x * MAG, stlf.coordArray[i+1].y * MAG, stlf.coordArray[i+1].z * MAG);
             Geom.P p2 = geom.newP(stlf.coordArray[i+2].x * MAG, stlf.coordArray[i+2].y * MAG, stlf.coordArray[i+2].z * MAG);
             Geom.V n  = geom.new V(stlf.normArray[i/3].x * MAG, stlf.normArray[i/3].y  * MAG, stlf.normArray[i/3].z * MAG);
-            Geom.T t  = geom.newT(geom.newE(p0, p1), geom.newE(p1, p2), geom.newE(p2, p0), n);
+            Geom.T t  = geom.newT(p0, p1, p2, n);
         }
-
         */
 
+
     }
 
     /**
@@ -217,17 +233,18 @@ public class Main implements GLEventListener {
             Geom.P centroid = t.centroid();
             gl.glBegin(GL.GL_LINES);
             gl.glColor3f(1, 1, 1);
-
+            /*
             centroid.glVertex(gl);
             centroid.plus(t.norm().times(t.diameter())).glVertex(gl);
-            /*
+            */
+
             t.p1().glVertex(gl);
             t.p1().plus(t.p1().norm().times(t.diameter())).glVertex(gl);
             t.p2().glVertex(gl);
             t.p2().plus(t.p2().norm().times(t.diameter())).glVertex(gl);
             t.p3().glVertex(gl);
             t.p3().plus(t.p3().norm().times(t.diameter())).glVertex(gl);
-            */
+
             gl.glEnd();
 
         }