X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fqfat%2Fbind%2FBindingGroup.java;h=501fb813c0b71a95a0c916e6f93a305981709505;hp=9356ec455b6aceae2696800a9b520e38947629c0;hb=d52f92b29c1987b5734c7183a9c01b5660f86482;hpb=553823b9fbe373bbc8b5409c423857253f18c4aa diff --git a/src/edu/berkeley/qfat/bind/BindingGroup.java b/src/edu/berkeley/qfat/bind/BindingGroup.java index 9356ec4..501fb81 100644 --- a/src/edu/berkeley/qfat/bind/BindingGroup.java +++ b/src/edu/berkeley/qfat/bind/BindingGroup.java @@ -1,6 +1,5 @@ package edu.berkeley.qfat.bind; import edu.berkeley.qfat.geom.*; -import javax.media.opengl.*; import java.util.*; /** @@ -10,15 +9,24 @@ import java.util.*; */ class BindingGroup implements Iterable { + /** the arbitrarily-chosen master of the binding group */ private T master = null; - private AffineConstraint constraint = new AffineConstraint.All(); + + /** the affine constraint, in master coordinates, of this binding group */ + private AffineConstraint constraint = AffineConstraint.ALL; + + /** + * For each member of the binding group, the matrix which must be + * multiplied by the master to get the member's position + */ private HashMap matrices = new HashMap(); - public BindingGroup(T master) { + BindingGroup(T master) { this.master = master; matrices.put(master, Matrix.ONE); } + /** the size of this binding group */ int size() { return matrices.size(); } /** merge another binding group into this one */ @@ -45,19 +53,19 @@ class BindingGroup implements Iterable { bg.matrices = null; } - public Matrix getMatrix(T t) { return matrices.get(t); } + Matrix getMatrix(T t) { return matrices.get(t); } public Iterator iterator() { return matrices.keySet().iterator(); } /** t1 = getMatrix(t1, t2) * t2 */ - public Matrix getMatrix(T t1, T t2) { + Matrix getMatrix(T t1, T t2) { // t1 = getMatrix(t1) * master // getMatrix(t2)^-1 * t2 = master // t1 = getMatrix(t1) * getMatrix(t2)^-1 * t2 return getMatrix(t1).times(getMatrix(t2).inverse()); } - public AffineConstraint getAffineConstraint(T t) { + AffineConstraint getAffineConstraint(T t) { return constraint.multiply(matrices.get(t)); } @@ -88,7 +96,7 @@ class BindingGroup implements Iterable { matrices = newmatrices; } - public boolean contains(HasBindingGroup t) { + boolean contains(HasBindingGroup t) { return matrices.get((T)t) != null; } }