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
/
geom
/
BindingGroup.java
diff --git
a/src/edu/berkeley/qfat/geom/BindingGroup.java
b/src/edu/berkeley/qfat/geom/BindingGroup.java
index
4df8cc4
..
34259ab
100644
(file)
--- a/
src/edu/berkeley/qfat/geom/BindingGroup.java
+++ b/
src/edu/berkeley/qfat/geom/BindingGroup.java
@@
-5,8
+5,9
@@
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> {
/** 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> {
- private T master = null;
- private HashMap<T,Matrix> matrices = new HashMap<T,Matrix>();
+ private T master = null;
+ private AffineConstraint constraint = new AffineConstraint.All();
+ private HashMap<T,Matrix> matrices = new HashMap<T,Matrix>();
public BindingGroup(T master) {
this.master = master;
public BindingGroup(T master) {
this.master = master;
@@
-16,13
+17,20
@@
public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
public int size() { return matrices.size(); }
public void merge(BindingGroup<T> bg, Matrix m) {
public int size() { return matrices.size(); }
public void merge(BindingGroup<T> bg, Matrix m) {
- if (bg==this) throw new Error();
+ if (bg==this) {
+ if (m.equalsModuloEpsilon(Matrix.ONE, 0.001f)) return;
+ constraint = constraint.intersect(m.getAffineConstraint(0.001f), 0.001f);
+ return;
+ }
+
for(HasBindingGroup hbg : bg.matrices.keySet()) {
matrices.put((T)hbg, bg.matrices.get(hbg).times(m));
hbg.bindingGroup = this;
}
for(HasBindingGroup hbg : bg.matrices.keySet()) {
matrices.put((T)hbg, bg.matrices.get(hbg).times(m));
hbg.bindingGroup = this;
}
- Matrix v = getMatrix(bg.master, master);
+ // 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);
HashSet<HasBindingGroup> stuff = new HashSet<HasBindingGroup>();
for(HasBindingGroup hbg : bg.matrices.keySet())
HashSet<HasBindingGroup> stuff = new HashSet<HasBindingGroup>();
for(HasBindingGroup hbg : bg.matrices.keySet())
@@
-45,6
+53,10
@@
public 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) {
+ return constraint.multiply(matrices.get(t));
+ }
+
public void unbind(T trem) {
if (trem != master) {
matrices.remove(trem);
public void unbind(T trem) {
if (trem != master) {
matrices.remove(trem);