public static Random random = new Random();
private HashMap<Point,Vert> ps = new HashMap<Point,Vert>();
- 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>();
public Iterator<T> iterator() { return ts.iterator(); }
public double score = 0;
public float score() { return (float)score; }
- public void unbind() {
+ public int numedges = 0;
+ public float avgedge = 0;
+ public void unbind() {
for(Mesh.T t : this) {
t.p1().unbind();
t.p2().unbind();
t.p3().unbind();
}
-
}
+
public void bind() {
for(Mesh.T t : this) {
t.e1().dobind();
t.e3().dobind();
}
}
- public int numedges = 0;
- public float avgedge = 0;
public float rescore() {
int num = 0;
(float)(max_z + min_z)/2);
}
- public T newT(Vert p12, Vert p23, Vert p31, Vec norm) {
- Vec norm2 = p31.p.minus(p12.p).cross(p23.p.minus(p12.p));
- float dot = norm.dot(norm2);
- //if (Math.abs(dot) < EPointSILON) throw new Error("dot products within epsilon of each other: "+norm+" "+norm2);
- if (dot < 0) { Vert p = p12; p12=p23; p23 = p; }
- return newT(p12, p23, p31);
- }
-
public float volume() {
double total = 0;
for(T t : ts) {
return (Vert)results[0];
}
- public T newT(Vert p1, Vert p2, Vert p3) {
+ public T newT(Vert p1, Vert p2, Vert p3, Vec norm) {
+ if (norm != null) {
+ Vec norm2 = p3.p.minus(p1.p).cross(p2.p.minus(p1.p));
+ float dot = norm.dot(norm2);
+ //if (Math.abs(dot) < EPointSILON) throw new Error("dot products within epsilon of each other: "+norm+" "+norm2);
+ if (dot < 0) { Vert p = p1; p1=p2; p2 = p; }
+ }
E e12 = p1.makeE(p2);
E e23 = p2.makeE(p3);
E e31 = p3.makeE(p1);
score += oldscore;
}
-
/** does NOT update bound pairs! */
public boolean transform(Matrix m) {
// FIXME: screws up kdtree
pair.shatter();
destroy();
- newT(r, p1, mid);
- newT(r, mid, p2);
+ newT(r, p1, mid, null);
+ newT(r, mid, p2, null);
bg1.add(p1.getE(mid));
bg2.add(mid.getE(p2));
return mid;