projects
/
anneal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
checkpoint
[anneal.git]
/
src
/
edu
/
berkeley
/
qfat
/
bind
/
BindingGroup.java
diff --git
a/src/edu/berkeley/qfat/bind/BindingGroup.java
b/src/edu/berkeley/qfat/bind/BindingGroup.java
index
270bc78
..
9356ec4
100644
(file)
--- a/
src/edu/berkeley/qfat/bind/BindingGroup.java
+++ b/
src/edu/berkeley/qfat/bind/BindingGroup.java
@@
-21,7
+21,7
@@
class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
int size() { return matrices.size(); }
int size() { return matrices.size(); }
- /** merge another binding group with this one */
+ /** merge another binding group into this one */
void merge(BindingGroup<T> bg, Matrix m, float epsilon) {
if (bg==this) {
if (m.equalsModuloEpsilon(Matrix.ONE, epsilon)) return;
void merge(BindingGroup<T> bg, Matrix m, float epsilon) {
if (bg==this) {
if (m.equalsModuloEpsilon(Matrix.ONE, epsilon)) return;
@@
-30,8
+30,8
@@
class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
return;
}
return;
}
- for(HasBindingGroup hbg : bg.matrices.keySet()) {
- matrices.put((T)hbg, bg.matrices.get(hbg).times(m));
+ for(HasBindingGroup hbg : bg) {
+ matrices.put((T)hbg, bg.getMatrix((T)hbg).times(m));
hbg.bindingGroup = this;
}
hbg.bindingGroup = this;
}
@@
-40,9
+40,9
@@
class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
constraint = constraint.intersect(ac, epsilon);
bg.master = null;
constraint = constraint.intersect(ac, epsilon);
bg.master = null;
- for(HasBindingGroup hbg : bg.matrices.keySet())
- hbg.bindingGroupChanged();
+ for(HasBindingGroup hbg : bg) hbg.bindingGroupChanged();
bg.matrices.clear();
bg.matrices.clear();
+ bg.matrices = null;
}
public Matrix getMatrix(T t) { return matrices.get(t); }
}
public Matrix getMatrix(T t) { return matrices.get(t); }
@@
-57,11
+57,11
@@
class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
return getMatrix(t1).times(getMatrix(t2).inverse());
}
return getMatrix(t1).times(getMatrix(t2).inverse());
}
- public AffineConstraint getConstraint(T t) {
+ public AffineConstraint getAffineConstraint(T t) {
return constraint.multiply(matrices.get(t));
}
return constraint.multiply(matrices.get(t));
}
- public void unbind(T trem) {
+ void unbind(T trem) {
if (trem != master) {
matrices.remove(trem);
return;
if (trem != master) {
matrices.remove(trem);
return;
@@
-74,7
+74,11
@@
class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
Iterator<T> it = iterator();
T newmaster = it.next();
if (newmaster==trem) newmaster = it.next();
Iterator<T> it = iterator();
T newmaster = it.next();
if (newmaster==trem) newmaster = it.next();
- if (newmaster==trem) throw new Error();
+ if (newmaster==trem) throw new Error("impossible");
+
+ // FIXME: is this correct?
+ constraint = constraint.multiply(getMatrix(newmaster, master));
+
HashMap<T,Matrix> newmatrices = new HashMap<T,Matrix>();
for(T t : matrices.keySet()) {
if (t==trem) continue;
HashMap<T,Matrix> newmatrices = new HashMap<T,Matrix>();
for(T t : matrices.keySet()) {
if (t==trem) continue;