checkpoint
authoradam <adam@megacz.com>
Mon, 7 Jul 2008 19:13:29 +0000 (12:13 -0700)
committeradam <adam@megacz.com>
Mon, 7 Jul 2008 19:13:29 +0000 (12:13 -0700)
darcs-hash:20080707191329-5007d-2ba896909f16b75331bc02b03c9f46eed36eeaa3.gz

src/edu/berkeley/qfat/Mesh.java
src/edu/berkeley/qfat/bind/BindingGroup.java
src/edu/berkeley/qfat/bind/HasBindingGroup.java

index e124072..3a53041 100644 (file)
@@ -610,13 +610,9 @@ public class Mesh implements Iterable<Mesh.T> {
 
         }
 
-        public void bindingGroupChanged(BindingGroup newBindingGroup_) {
-
-            BindingGroup<E> newBindingGroup = (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;
index 0882fa5..e93edf8 100644 (file)
@@ -3,8 +3,12 @@ import edu.berkeley.qfat.geom.*;
 import javax.media.opengl.*;
 import java.util.*;
 
-/** tracks an equivalence class of geometric objects which are related to each other by transformation matrices */
-public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
+/**
+ *  An equivalence class of geometric objects whose positions are
+ *  related by affine transformation matrices and are constrained by
+ *  an affine constraint.
+ */
+class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
 
     private T                  master     = null;
     private AffineConstraint   constraint = new AffineConstraint.All();
@@ -15,9 +19,10 @@ public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
         matrices.put(master, Matrix.ONE);
     }
 
-    public int size() { return matrices.size(); }
+    int size() { return matrices.size(); }
 
-    public void merge(BindingGroup<T> bg, Matrix m) {
+    /** merge another binding group with this one */
+    void merge(BindingGroup<T> bg, Matrix m) {
         if (bg==this) {
             if (m.equalsModuloEpsilon(Matrix.ONE, 0.001f)) return;
             constraint = constraint.intersect(m.getAffineConstraint(0.001f), 0.001f);
@@ -39,7 +44,7 @@ public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
         bg.matrices.clear();
         bg.master = null;
         for(HasBindingGroup hbg : stuff)
-            hbg.bindingGroupChanged(this);
+            hbg.bindingGroupChanged();
     }
 
     public Matrix getMatrix(T t) { return matrices.get(t); }
index a50a430..ee8157a 100644 (file)
@@ -48,7 +48,7 @@ public abstract class HasBindingGroup {
         if (bindingGroup==null) return;
         bindingGroup.unbind(this);
         bindingGroup = null;
-        bindingGroupChanged(bindingGroup);
+        bindingGroupChanged();
     }
 
     public boolean isBoundTo(HasBindingGroup t) {
@@ -59,5 +59,5 @@ public abstract class HasBindingGroup {
         if (bindingGroup==null) bindingGroup = new BindingGroup(this);
         return bindingGroup;
     }
-    public void bindingGroupChanged(BindingGroup newBindingGroup) { }
+    public void bindingGroupChanged() { }
 }