projects
/
anneal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ef71dff
)
checkpoint
author
adam
<adam@megacz.com>
Wed, 5 Dec 2007 05:15:19 +0000
(21:15 -0800)
committer
adam
<adam@megacz.com>
Wed, 5 Dec 2007 05:15:19 +0000
(21:15 -0800)
darcs-hash:
20071205051519
-5007d-
49c64dc1f1b448c0d237b6621060e1845a39b949
.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
0a26699
..
e06ac65
100644
(file)
--- a/
src/edu/berkeley/qfat/Mesh.java
+++ b/
src/edu/berkeley/qfat/Mesh.java
@@
-11,11
+11,12
@@
import edu.berkeley.qfat.geom.Point;
public class Mesh implements Iterable<Mesh.T> {
public class Mesh implements Iterable<Mesh.T> {
- private KDTree kd = new KDTree(3);
public static float EPSILON = (float)0.0001;
public static Random random = new Random();
public static float EPSILON = (float)0.0001;
public static Random random = new Random();
+ private PointSet<Vert> pointset = new PointSet<Vert>();
+ public Vert nearest(Point p) { return pointset.nearest(p); }
private HashMap<Point,Vert> verts = new HashMap<Point,Vert>();
public Iterable<E> edges() {
private HashMap<Point,Vert> verts = new HashMap<Point,Vert>();
public Iterable<E> edges() {
@@
-81,7
+82,7
@@
public class Mesh implements Iterable<Mesh.T> {
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdremove();
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdremove();
- kd = new KDTree(3);
+ pointset.clear();
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdinsert();
for(T t : this)
for(Vert p : new Vert[] { t.v1(), t.v2(), t.v3() })
p.kdinsert();
@@
-144,11
+145,6
@@
public class Mesh implements Iterable<Mesh.T> {
return (float)total;
}
return (float)total;
}
- public Vert nearest(Point p) {
- Object[] results;
- try { results = kd.nearest(new double[]{p.x,p.y,p.z},1); } catch (Exception e) { throw new Error(e); }
- return (Vert)results[0];
- }
public class BindingGroup {
public HashSet<E> es = new HashSet<E>();
public class BindingGroup {
public HashSet<E> es = new HashSet<E>();
@@
-181,12
+177,12
@@
public class Mesh implements Iterable<Mesh.T> {
public void kdremove() {
if (!inserted) return;
inserted = false;
public void kdremove() {
if (!inserted) return;
inserted = false;
- try { kd.delete(new double[]{p.x,p.y,p.z}); } catch (Exception e) { }
+ pointset.remove(this);
}
public void kdinsert() {
if (inserted) return;
inserted = true;
}
public void kdinsert() {
if (inserted) return;
inserted = true;
- try { kd.insert(new double[]{p.x,p.y,p.z},this); } catch (Exception e) { throw new Error(e); }
+ pointset.add(this);
}
public float score() { return oldscore; }
}
public float score() { return oldscore; }