checkpoint
[anneal.git] / src / edu / berkeley / qfat / Mesh.java
index 43927d4..3a53041 100644 (file)
@@ -6,8 +6,8 @@ import javax.swing.*;
 import javax.media.opengl.*;
 import javax.media.opengl.glu.*;
 import edu.berkeley.qfat.geom.*;
-import edu.berkeley.qfat.geom.HasBindingGroup;
 import edu.wlu.cs.levy.CG.KDTree;
+import edu.berkeley.qfat.bind.*;
 import edu.berkeley.qfat.geom.Point;
 import com.infomatiq.jsi.IntProcedure;
 
@@ -408,20 +408,12 @@ public class Mesh implements Iterable<Mesh.T> {
             */
 
             Point op = this.p;
-            Point pp = vv.plus(getPoint());
-            if (bindingGroup != null) {
-                /*
-                for(int i=0; i<20 ; i++) {
-                    Point v2 = getConstraint().times(pp);
-                    pp = pp.midpoint(v2);
-                    //System.out.println(m.minus(m2));
-                }
-            */
-                //pp = getConstraint().times(pp);
-            }
-            //pp = pp.minus(op).norm().times(vv.mag()).plus(op);
-            ok = false;
-            Point pt = pp;
+            Point pt = vv.plus(getPoint());
+            Point pp = pt;
+            pt = getBindingConstraint().getProjection(pp);
+            if (pt==null) return false;
+            System.out.println(pt.minus(pp).mag() + " " + getBindingConstraint());
+
             for(Vertex v : (Iterable<Vertex>)getBoundPeers()) {
                 Point pt2 = v.getBindingMatrix(this).times(pt);
                 /*
@@ -618,14 +610,9 @@ public class Mesh implements Iterable<Mesh.T> {
 
         }
 
-        public void bindingGroupChanged(edu.berkeley.qfat.geom.BindingGroup newBindingGroup_) {
-
-            edu.berkeley.qfat.geom.BindingGroup<E> newBindingGroup =
-                (edu.berkeley.qfat.geom.BindingGroup<E>)newBindingGroup_;
-            if (newBindingGroup==null) return;
-            //if (this==newBindingGroup.getMaster()) return;
+        public void bindingGroupChanged() {
             HashSet<E> nbg = new HashSet<E>();
-            for(E eother : (Iterable<E>)newBindingGroup) nbg.add(eother);
+            for(E eother : (Iterable<E>)getBoundPeers()) nbg.add(eother);
             for(E eother : nbg) {
                 if (next==null || prev==null) continue;
                 if (eother.next==null || eother.prev==null) continue;