projects
/
anneal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d39304b
)
checkpoint
author
adam
<adam@megacz.com>
Sun, 16 Dec 2007 03:48:00 +0000
(19:48 -0800)
committer
adam
<adam@megacz.com>
Sun, 16 Dec 2007 03:48:00 +0000
(19:48 -0800)
darcs-hash:
20071216034800
-5007d-
43969f24abc735884576ac172ce1a6b621ea0ac2
.gz
src/edu/berkeley/qfat/Mesh.java
patch
|
blob
|
history
diff --git
a/src/edu/berkeley/qfat/Mesh.java
b/src/edu/berkeley/qfat/Mesh.java
index
0e2c1d6
..
c2d2988
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-109,11
+109,7
@@
public class Mesh implements Iterable<Mesh.T> {
return m.times(1/(float)count);
}
return m.times(1/(float)count);
}
- public HasQuadric nearest() {
- if (error_against==null) return null;
- return error_against.vertices.nearest(p, this);
- }
-
+ public HasQuadric nearest() { return error_against==null ? null : error_against.vertices.nearest(p, this); }
public void computeError() {
float nerror =
quadric_count != 0
public void computeError() {
float nerror =
quadric_count != 0
@@
-132,15
+128,6
@@
public class Mesh implements Iterable<Mesh.T> {
setError(nerror);
}
setError(nerror);
}
- private void removeTrianglesFromRTree() {
- for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
- if (e.t != null) e.t.removeFromRTree();
- }
- private void addTrianglesToRTree() {
- for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
- if (e.t != null) e.t.addToRTree();
- }
-
/** does NOT update bound pairs! */
public boolean transform(Matrix m) {
if (immutableVertices) throw new Error();
/** does NOT update bound pairs! */
public boolean transform(Matrix m) {
if (immutableVertices) throw new Error();
@@
-150,12
+137,11
@@
public class Mesh implements Iterable<Mesh.T> {
if (vertices.get(this.p)==null) throw new Error();
vertices.remove(this);
if (vertices.get(this.p)==null) throw new Error();
vertices.remove(this);
- removeTrianglesFromRTree();
- float newx = m.a*p.x + m.b*p.y + m.c*p.z + m.d;
- float newy = m.e*p.x + m.f*p.y + m.g*p.z + m.h;
- float newz = m.i*p.x + m.j*p.y + m.k*p.z + m.l;
- this.p = new Point(newx, newy, newz);
- addTrianglesToRTree();
+ for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
+ if (e.t != null) e.t.removeFromRTree();
+ this.p = m.times(this.p);
+ for(E e = this.e; e!=null; e=e.pair.next==this.e?null:e.pair.next)
+ if (e.t != null) e.t.addToRTree();
vertices.add(this);
applyQuadricToNeighbor();
vertices.add(this);
applyQuadricToNeighbor();
@@
-203,18
+189,14
@@
public class Mesh implements Iterable<Mesh.T> {
public boolean move(Vec v) {
Matrix m = Matrix.translate(v);
public boolean move(Vec v) {
Matrix m = Matrix.translate(v);
-
boolean good = true;
for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
good &= p.transform(m);
boolean good = true;
for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
good &= p.transform(m);
-
- if (good) {
- for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
+ for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
+ if (good)
p.reComputeErrorAround();
p.reComputeErrorAround();
- } else {
- for(Vertex p = this; p != null; p = (p.bound_to==this)?null:p.bound_to)
+ else
p.transform(Matrix.translate(v.times(-1)));
p.transform(Matrix.translate(v.times(-1)));
- }
return good;
}
return good;
}