int size() { return matrices.size(); }
/** merge another binding group with this one */
- void merge(BindingGroup<T> bg, Matrix m) {
+ void merge(BindingGroup<T> bg, Matrix m, float epsilon) {
if (bg==this) {
- if (m.equalsModuloEpsilon(Matrix.ONE, 0.001f)) return;
- constraint = constraint.intersect(m.getAffineConstraint(0.001f), 0.001f);
+ if (m.equalsModuloEpsilon(Matrix.ONE, epsilon)) return;
+ // FIXME: what if points do not fall on the merged constraint-line?
+ constraint = constraint.intersect(m.getAffineConstraint(epsilon), epsilon);
return;
}
// FIXME: what if points do not fall on the merged constraint-line?
AffineConstraint ac = bg.constraint.multiply(getMatrix(master, bg.master));
- constraint = constraint.intersect(ac, 0.001f);
+ constraint = constraint.intersect(ac, epsilon);
- HashSet<HasBindingGroup> stuff = new HashSet<HasBindingGroup>();
- for(HasBindingGroup hbg : bg.matrices.keySet())
- stuff.add(hbg);
- bg.matrices.clear();
bg.master = null;
- for(HasBindingGroup hbg : stuff)
+ for(HasBindingGroup hbg : bg.matrices.keySet())
hbg.bindingGroupChanged();
+ bg.matrices.clear();
}
public Matrix getMatrix(T t) { return matrices.get(t); }