projects
/
anneal.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
8918917
)
checkpoint
author
adam
<adam@megacz.com>
Wed, 5 Dec 2007 03:26:31 +0000
(19:26 -0800)
committer
adam
<adam@megacz.com>
Wed, 5 Dec 2007 03:26:31 +0000
(19:26 -0800)
darcs-hash:
20071205032631
-5007d-
c425261bd24cc4e183fc92ea17f05bb4174d6a5e
.gz
src/Geom.java
patch
|
blob
|
history
diff --git
a/src/Geom.java
b/src/Geom.java
index
c7374f7
..
89acb70
100644
(file)
--- a/
src/Geom.java
+++ b/
src/Geom.java
@@
-13,7
+13,7
@@
public class Geom implements Iterable<Geom.T> {
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 HashMap<P,P> ps = new HashMap<P,P>();
+ private HashMap<P,V> ps = new HashMap<P,V>();
public HashSet<E> es = new HashSet<E>();
public ArrayList<T> ts = new ArrayList<T>();
public HashSet<E> es = new HashSet<E>();
public ArrayList<T> ts = new ArrayList<T>();
@@
-143,9
+143,15
@@
public class Geom implements Iterable<Geom.T> {
public M aspect = new M();
public M invaspect = new M();
public M aspect = new M();
public M invaspect = new M();
- /** [UNIQUE] point in 3-space */
- public final class P {
+ public final class V extends P {
+ public V(P p) {
+ super(p.x, p.y, p.z);
+ if (ps.get(p) != null) throw new Error();
+ ps.put(this, this);
+ }
+ }
+ public class P {
float x, y, z;
int watch_count;
float x, y, z;
int watch_count;
@@
-162,10
+168,10
@@
public class Geom implements Iterable<Geom.T> {
private boolean inserted = false;
private boolean inserted = false;
- public P register() {
- P p2 = ps.get(this);
- if (p2==null) { p2 = this; ps.put(this,this); }
- return p2;
+ public V register() {
+ V v = ps.get(this);
+ if (v==null) v = new V(this);
+ return (V)v;
}
public void kdremove() {
}
public void kdremove() {
@@
-257,7
+263,7
@@
public class Geom implements Iterable<Geom.T> {
this.y = newy;
this.z = newz;
// FIXME: what if we move onto exactly where another point is?
this.y = newy;
this.z = newz;
// FIXME: what if we move onto exactly where another point is?
- ps.put(this,this);
+ ps.put((V)this,(V)this);
} catch (Exception e) {
throw new RuntimeException(e);
}
} catch (Exception e) {
throw new RuntimeException(e);
}