projects
/
anneal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
2b09dab
)
checkpoint
author
adam
<adam@megacz.com>
Tue, 18 Dec 2007 05:23:55 +0000
(21:23 -0800)
committer
adam
<adam@megacz.com>
Tue, 18 Dec 2007 05:23:55 +0000
(21:23 -0800)
darcs-hash:
20071218052355
-5007d-
3e3bae9b3466cca98af2e44de859377b1906452d
.gz
src/edu/berkeley/qfat/Main.java
patch
|
blob
|
history
src/edu/berkeley/qfat/Mesh.java
patch
|
blob
|
history
src/edu/berkeley/qfat/geom/BindingGroup.java
patch
|
blob
|
history
src/edu/berkeley/qfat/geom/HasBindingGroup.java
patch
|
blob
|
history
src/edu/berkeley/qfat/geom/Matrix.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/qfat/Main.java
b/src/edu/berkeley/qfat/Main.java
index
75bfd7e
..
641e440
100644
(file)
--- a/
src/edu/berkeley/qfat/Main.java
+++ b/
src/edu/berkeley/qfat/Main.java
@@
-86,9
+86,10
@@
public class Main extends MeshViewer {
float halfup = 0;
translations = new Matrix[] {
float halfup = 0;
translations = new Matrix[] {
+
Matrix.translate(new Vec(lshift, depth, halfup)),
Matrix.translate(new Vec(lshift, depth, halfup)),
- /*
Matrix.translate(new Vec(rshift, depth, halfup)),
Matrix.translate(new Vec(rshift, depth, halfup)),
+ /*
Matrix.translate(new Vec(lshift, -depth, halfup)),
Matrix.translate(new Vec(rshift, -depth, halfup)),
*/
Matrix.translate(new Vec(lshift, -depth, halfup)),
Matrix.translate(new Vec(rshift, -depth, halfup)),
*/
diff --git
a/src/edu/berkeley/qfat/Mesh.java
b/src/edu/berkeley/qfat/Mesh.java
index
60aa9ab
..
b6ff386
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-355,10
+355,15
@@
public class Mesh implements Iterable<Mesh.T> {
return e.comparator() > comparator() ? 1 : -1;
}
public void bindEdge(E e, Matrix m) {
return e.comparator() > comparator() ? 1 : -1;
}
public void bindEdge(E e, Matrix m) {
+ _bindEdge(e, m);
+ pair._bindEdge(e.pair, m);
+ }
+ public void _bindEdge(E e, Matrix m) {
//bind_to.add(e);
//bind_to.add(e);
- //assumes edges are identical length at binding time
e = e.pair;
e = e.pair;
+ /*
+ //assumes edges are identical length at binding time
Vec reflectionPlaneNormal = e.p2.p.minus(e.p1.p).norm();
float a = reflectionPlaneNormal.x;
float b = reflectionPlaneNormal.y;
Vec reflectionPlaneNormal = e.p2.p.minus(e.p1.p).norm();
float a = reflectionPlaneNormal.x;
float b = reflectionPlaneNormal.y;
@@
-368,14
+373,13
@@
public class Mesh implements Iterable<Mesh.T> {
-2*a*b, 1-2*b*b, -2*b*c, 0,
-2*a*c, -2*b*c, 1-2*c*c, 0,
0, 0, 0, 1);
-2*a*b, 1-2*b*b, -2*b*c, 0,
-2*a*c, -2*b*c, 1-2*c*c, 0,
0, 0, 0, 1);
- /*
m = m.times(Matrix.translate(e.midpoint().minus(Point.ORIGIN))
.times(reflectionMatrix)
.times(Matrix.translate(Point.ORIGIN.minus(e.midpoint()))));
m = m.times(Matrix.translate(e.midpoint().minus(Point.ORIGIN))
.times(reflectionMatrix)
.times(Matrix.translate(Point.ORIGIN.minus(e.midpoint()))));
- */
System.out.println(reflectionPlaneNormal);
System.out.println(" " + p1.p + " " + m.times(e.p1.p));
System.out.println(" " + p2.p + " " + m.times(e.p2.p));
System.out.println(reflectionPlaneNormal);
System.out.println(" " + p1.p + " " + m.times(e.p1.p));
System.out.println(" " + p2.p + " " + m.times(e.p2.p));
+ */
if (m.times(e.p1.p).minus(p1.p).mag() > EPSILON) throw new Error();
if (m.times(e.p2.p).minus(p2.p).mag() > EPSILON) throw new Error();
this.bindTo(m, e);
if (m.times(e.p1.p).minus(p1.p).mag() > EPSILON) throw new Error();
if (m.times(e.p2.p).minus(p2.p).mag() > EPSILON) throw new Error();
this.bindTo(m, e);
diff --git
a/src/edu/berkeley/qfat/geom/BindingGroup.java
b/src/edu/berkeley/qfat/geom/BindingGroup.java
index
d1ff8b8
..
aec9329
100644
(file)
--- a/
src/edu/berkeley/qfat/geom/BindingGroup.java
+++ b/
src/edu/berkeley/qfat/geom/BindingGroup.java
@@
-13,6
+13,7
@@
public class BindingGroup<T extends HasBindingGroup> implements Iterable<T> {
}
public void merge(BindingGroup<T> bg, Matrix m) {
}
public void merge(BindingGroup<T> bg, Matrix m) {
+ if (bg==this) throw new Error();
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;
diff --git
a/src/edu/berkeley/qfat/geom/HasBindingGroup.java
b/src/edu/berkeley/qfat/geom/HasBindingGroup.java
index
fc12a29
..
5b761a3
100644
(file)
--- a/
src/edu/berkeley/qfat/geom/HasBindingGroup.java
+++ b/
src/edu/berkeley/qfat/geom/HasBindingGroup.java
@@
-16,7
+16,8
@@
public abstract class HasBindingGroup {
if (other.bindingGroup == null) other.bindingGroup = new BindingGroup(other);
if (other.bindingGroup == this.bindingGroup) {
if (other.bindingGroup == null) other.bindingGroup = new BindingGroup(other);
if (other.bindingGroup == this.bindingGroup) {
- if (getBindingMatrix(other).equals(bindingMatrix)) return;
+ if (getBindingMatrix(other).equals(bindingMatrix))
+ return;
throw new Error("rebind attempt: "+this+" and "+other+" with "
+ bindingMatrix
+ "; expected "
throw new Error("rebind attempt: "+this+" and "+other+" with "
+ bindingMatrix
+ "; expected "
@@
-24,7
+25,7
@@
public abstract class HasBindingGroup {
}
bindingMatrix =
}
bindingMatrix =
- getBindingMatrix()
+ getBindingMatrix().inverse()
.times(bindingMatrix)
.times(other.getBindingMatrix());
other.bindingGroup.merge(bindingGroup, bindingMatrix);
.times(bindingMatrix)
.times(other.getBindingMatrix());
other.bindingGroup.merge(bindingGroup, bindingMatrix);
diff --git
a/src/edu/berkeley/qfat/geom/Matrix.java
b/src/edu/berkeley/qfat/geom/Matrix.java
index
1c52d00
..
dbe4076
100644
(file)
--- a/
src/edu/berkeley/qfat/geom/Matrix.java
+++ b/
src/edu/berkeley/qfat/geom/Matrix.java
@@
-256,7
+256,7
@@
public class Matrix {
near(p,z.p);
}
private static final float EPSILON = 0.001f;
near(p,z.p);
}
private static final float EPSILON = 0.001f;
- private static boolean near(float a, float b) { return a==b; }
+ private static boolean near(float a, float b) { return Math.abs(a-b)<EPSILON; }
public int hashCode() {
return
public int hashCode() {
return