checkpoint
authoradam <adam@megacz.com>
Wed, 5 Dec 2007 04:11:54 +0000 (20:11 -0800)
committeradam <adam@megacz.com>
Wed, 5 Dec 2007 04:11:54 +0000 (20:11 -0800)
darcs-hash:20071205041154-5007d-9990b4f0faae2b861164e5311f9017592cbc7ad3.gz

src/edu/berkeley/qfat/Geom.java
src/edu/berkeley/qfat/Main.java

index 48484b6..80d2dd6 100644 (file)
@@ -14,13 +14,13 @@ public class Geom implements Iterable<Geom.T> {
     public static float EPSILON = (float)0.0001;
     public static Random random = new Random();
 
-    private HashMap<P,V>  ps = new HashMap<P,V>();
+    private HashMap<Point,Vert>  ps = new HashMap<Point,Vert>();
     public  HashSet<E>    es = new HashSet<E>();
     public  ArrayList<T>  ts = new ArrayList<T>();
 
     public Iterator<T> iterator() { return ts.iterator(); }
 
-    public P origin() { return new P(0, 0, 0); }
+    public Point origin() { return new Point(0, 0, 0); }
 
     public Geom score_against = null;
     public double score = 0;
@@ -48,27 +48,27 @@ public class Geom implements Iterable<Geom.T> {
     public float rescore() {
         int num = 0;
         double dist = 0;
-        HashSet<V> done = new HashSet<V>();
+        HashSet<Vert> done = new HashSet<Vert>();
         for(T t : ts)
-            for(V p : new V[] { t.p1(), t.p2(), t.p3() }) {
+            for(Vert p : new Vert[] { t.p1(), t.p2(), t.p3() }) {
                 if (done.contains(p)) continue;
                 done.add(p);
                 p.rescore();
             }
         for(T t : ts)
-            for(V p : new V[] { t.p1(), t.p2(), t.p3() })
+            for(Vert p : new Vert[] { t.p1(), t.p2(), t.p3() })
                 p.kdremove();
         kd = new KDTree(3);
         for(T t : ts)
-            for(V p : new V[] { t.p1(), t.p2(), t.p3() })
+            for(Vert p : new Vert[] { t.p1(), t.p2(), t.p3() })
                 p.kdinsert();
         return (float)(dist/num);
     }
 
     public void transform(M m) {
-        ArrayList<V> set = new ArrayList<V>();
+        ArrayList<Vert> set = new ArrayList<Vert>();
         set.addAll(ps.values());
-        for(V v : set) v.transform(m);
+        for(Vert v : set) v.transform(m);
     }
 
     public Vec diagonal() {
@@ -78,7 +78,7 @@ public class Geom implements Iterable<Geom.T> {
         float max_x = Float.MIN_VALUE;
         float max_y = Float.MIN_VALUE;
         float max_z = Float.MIN_VALUE;
-        for(P p : ps.keySet()) {
+        for(Point p : ps.keySet()) {
             if (p.x < min_x) min_x = p.x;
             if (p.y < min_y) min_y = p.y;
             if (p.z < min_z) min_z = p.z;
@@ -89,14 +89,14 @@ public class Geom implements Iterable<Geom.T> {
         return new Vec(max_x - min_x, max_y - min_y, max_z - min_z);
     }
 
-    public P centroid() {
+    public Point centroid() {
         float min_x = Float.MAX_VALUE;
         float min_y = Float.MAX_VALUE;
         float min_z = Float.MAX_VALUE;
         float max_x = Float.MIN_VALUE;
         float max_y = Float.MIN_VALUE;
         float max_z = Float.MIN_VALUE;
-        for(P p : ps.keySet()) {
+        for(Point p : ps.keySet()) {
             if (p.x < min_x) min_x = p.x;
             if (p.y < min_y) min_y = p.y;
             if (p.z < min_z) min_z = p.z;
@@ -104,16 +104,16 @@ public class Geom implements Iterable<Geom.T> {
             if (p.y > max_y) max_y = p.y;
             if (p.z > max_z) max_z = p.z;
         }
-        return new P((float)(max_x + min_x)/2,
+        return new Point((float)(max_x + min_x)/2,
                      (float)(max_y + min_y)/2,
                      (float)(max_z + min_z)/2);
     }
 
-    public T newT(V p12, V p23, V p31, Vec norm) {
+    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) < EPSILON) throw new Error("dot products within epsilon of each other: "+norm+" "+norm2);
-        if (dot < 0) { V p = p12; p12=p23; p23 = p; }
+        //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);
     }
 
@@ -121,7 +121,7 @@ public class Geom implements Iterable<Geom.T> {
         double total = 0;
         for(T t : ts) {
             double area = t.area();
-            Vec origin_to_centroid = new Vec(new P(0, 0, 0), t.centroid());
+            Vec origin_to_centroid = new Vec(new Point(0, 0, 0), t.centroid());
             boolean facingAway = t.norm().dot(origin_to_centroid) > 0;
             double height = Math.abs(t.norm().dot(origin_to_centroid));
             total += ((facingAway ? 1 : -1) * area * height) / 3.0;
@@ -129,13 +129,13 @@ public class Geom implements Iterable<Geom.T> {
         return (float)total;
     }
 
-    public V nearest(P p) {
+    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 (V)results[0];
+        return (Vert)results[0];
     }
 
-    public T newT(V p1, V p2, V p3) {
+    public T newT(Vert p1, Vert p2, Vert p3) {
         E e12 = p1.makeE(p2);
         E e23 = p2.makeE(p3);
         E e31 = p3.makeE(p1);
@@ -170,9 +170,9 @@ public class Geom implements Iterable<Geom.T> {
         }
     }
 
-    public final class V {
-        public P p;
-        public V(P p) {
+    public final class Vert {
+        public Point p;
+        public Vert(Point p) {
             this.p = p;
             if (ps.get(p) != null) throw new Error();
             ps.put(this.p, this);
@@ -202,9 +202,9 @@ public class Geom implements Iterable<Geom.T> {
             }
             watch = null;
         }
-        public V partner() { return watch==null ? this : watch; }
-        public V watchback() { return watch_count==0 ? partner() :
-                register(new P(watch_x/watch_count, watch_y/watch_count, watch_z/watch_count)); }
+        public Vert partner() { return watch==null ? this : watch; }
+        public Vert watchback() { return watch_count==0 ? partner() :
+                register(new Point(watch_x/watch_count, watch_y/watch_count, watch_z/watch_count)); }
         public void rescore() {
             if (score_against == null) return;
 
@@ -212,7 +212,7 @@ public class Geom implements Iterable<Geom.T> {
             oldscore = 0;
 
             if (watch != null) unscore();
-            V po = this;
+            Vert po = this;
             if (watch == null) {
                 watch = score_against.nearest(po.p);
 
@@ -247,9 +247,9 @@ public class Geom implements Iterable<Geom.T> {
                 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 P(newx, newy, newz);
+                this.p = new Point(newx, newy, newz);
                 // FIXME: what if we move onto exactly where another point is?
-                ps.put(this.p,(V)this);
+                ps.put(this.p,(Vert)this);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -273,7 +273,7 @@ public class Geom implements Iterable<Geom.T> {
         }
         public boolean move(Vec v) {
             M m = new M(v);
-            V p = this;
+            Vert p = this;
             boolean good = true;
             do {
                 good &= p.transform(m);
@@ -283,7 +283,7 @@ public class Geom implements Iterable<Geom.T> {
             return good;
         }
 
-        public E makeE(V p2) {
+        public E makeE(Vert p2) {
             E e = getE(p2);
             if (e != null) return e;
             e = p2.getE(this);
@@ -309,7 +309,7 @@ public class Geom implements Iterable<Geom.T> {
             return null;
         }
 
-        public E getE(V p2) {
+        public E getE(Vert p2) {
             E e = this.e;
             do {
                 if (e==null) return null;
@@ -319,8 +319,8 @@ public class Geom implements Iterable<Geom.T> {
             return null;
         }
 
-        public boolean isBoundTo(V p) {
-            V px = p;
+        public boolean isBoundTo(Vert p) {
+            Vert px = p;
             do {
                 if (px==this) return true;
                 px = px.bound_to;
@@ -329,10 +329,10 @@ public class Geom implements Iterable<Geom.T> {
         }
 
         public void unbind() { bound_to = this; binding = new M(); }
-        public void bind(V p) { bind(p, new M()); }
-        public void bind(V p, M binding) {
+        public void bind(Vert p) { bind(p, new M()); }
+        public void bind(Vert p, M binding) {
             if (isBoundTo(p)) return;
-            V temp_bound_to = p.bound_to;
+            Vert temp_bound_to = p.bound_to;
             M temp_binding = p.binding;
             p.bound_to = this.bound_to;
             p.binding = binding.times(this.binding); // FIXME: may have order wrong here
@@ -349,12 +349,12 @@ public class Geom implements Iterable<Geom.T> {
             return norm.norm();
         }
 
-        V bound_to = this;
+        Vert bound_to = this;
         int watch_count;
         float watch_x;
         float watch_y;
         float watch_z;
-        V watch;
+        Vert watch;
         E e;                // some edge *leaving* this point
         M binding = new M();
         float oldscore = 0;
@@ -438,7 +438,7 @@ public class Geom implements Iterable<Geom.T> {
             return e.length() > length() ? 1 : -1;
         }
 
-        public final V p1, p2;
+        public final Vert p1, p2;
         T t;     // triangle to our "left"
         E prev;  // previous half-edge
         E next;  // next half-edge
@@ -460,12 +460,12 @@ public class Geom implements Iterable<Geom.T> {
         }
 
         boolean shattered = false;
-        public V shatter() { return shatter(register(midpoint()), null, null); }
-        public V shatter(V mid, BindingGroup bg1, BindingGroup bg2) {
+        public Vert shatter() { return shatter(register(midpoint()), null, null); }
+        public Vert shatter(Vert mid, BindingGroup bg1, BindingGroup bg2) {
             if (shattered) return mid;
             shattered = true;
 
-            V r = next.p2;
+            Vert r = next.p2;
             E next = this.next;
             E prev = this.prev;
 
@@ -557,7 +557,7 @@ public class Geom implements Iterable<Geom.T> {
         }
 
         /** creates an isolated edge out in the middle of space */
-        public E(V p1, V p2) {
+        public E(Vert p1, Vert p2) {
             if (p1==p2) throw new Error("attempt to create edge with single vertex: " + p1);
             this.p1 = p1;
             this.p2 = p2;
@@ -566,7 +566,7 @@ public class Geom implements Iterable<Geom.T> {
         }
 
         /** adds a new half-edge from prev.p2 to p2 */
-        public E(E prev, V p2) {
+        public E(E prev, Vert p2) {
             this.p1 = prev.p2;
             this.p2 = p2;
             this.prev = prev;
@@ -593,8 +593,8 @@ public class Geom implements Iterable<Geom.T> {
             this.pair = pair;
             sync();
         }
-        public P midpoint() { return new P((p1.p.x+p2.p.x)/2, (p1.p.y+p2.p.y)/2, (p1.p.z+p2.p.z)/2); }
-        public boolean has(V v) { return v==p1 || v==p2; }
+        public Point midpoint() { return new Point((p1.p.x+p2.p.x)/2, (p1.p.y+p2.p.y)/2, (p1.p.z+p2.p.z)/2); }
+        public boolean has(Vert v) { return v==p1 || v==p2; }
         public float length() { return p1.p.minus(p2.p).mag(); }
         public String toString() { return p1+"->"+p2; }
     }
@@ -608,7 +608,7 @@ public class Geom implements Iterable<Geom.T> {
             ts.remove(this);
         }
 
-        public V nearest(P p) {
+        public Vert nearest(Point p) {
             float d1 = p1().p.distance(p);
             float d2 = p2().p.distance(p);
             float d3 = p3().p.distance(p);
@@ -648,15 +648,15 @@ public class Geom implements Iterable<Geom.T> {
 
             this.color = color;
         }
-        public V p1() { return e1.p1; }
-        public V p2() { return e1.p2; }
-        public V p3() { return e1.next.p2; }
+        public Vert p1() { return e1.p1; }
+        public Vert p2() { return e1.p2; }
+        public Vert p3() { return e1.next.p2; }
         public E e1() { return e1; }
         public E e2() { return e1.next; }
         public E e3() { return e1.prev; }
         public Vec norm() { return p2().p.minus(p1().p).cross(p3().p.minus(p1().p)).norm(); }
         public boolean hasE(E e) { return e1==e || e1.next==e || e1.prev==e; }
-        public boolean has(V v) { return p1()==v || p2()==v || p3()==v; }
+        public boolean has(Vert v) { return p1()==v || p2()==v || p3()==v; }
 
         public float area() {
             return (float)Math.abs(0.5 * e1().length() * new Vec(p1().p, p2().p).norm().dot(new Vec(p2().p, p3().p)));
@@ -668,7 +668,7 @@ public class Geom implements Iterable<Geom.T> {
             p3().p.glVertex(gl);
         }
 
-        public P centroid() { return new P((p1().p.x+p2().p.x+p3().p.x)/3,
+        public Point centroid() { return new Point((p1().p.x+p2().p.x+p3().p.x)/3,
                                           (p1().p.y+p2().p.y+p3().p.y)/3, 
                                           (p1().p.z+p2().p.z+p3().p.z)/3); }
         public float diameter() {
@@ -679,21 +679,21 @@ public class Geom implements Iterable<Geom.T> {
 
     }
     
-    public V register(P p) { V v = ps.get(p); return v==null ? new V(p) : v; }
+    public Vert register(Point p) { Vert v = ps.get(p); return v==null ? new Vert(p) : v; }
 
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
     /** point in 3-space; immutable */
-    public static final class P {
+    public static final class Point {
         public final float x, y, z;
-        public P(double x, double y, double z) { this((float)x, (float)y, (float)z); }
-        public P(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
-        public float distance(P p) { return distance(p.x, p.y, p.z); }
+        public Point(double x, double y, double z) { this((float)x, (float)y, (float)z); }
+        public Point(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
+        public float distance(Point p) { return distance(p.x, p.y, p.z); }
         public float distance(float ox, float oy, float oz) { return (float)Math.sqrt((x-ox)*(x-ox)+(y-oy)*(y-oy)+(z-oz)*(z-oz)); }
-        public P times(M m) { return m.times(this); }
-        public Vec minus(P p) { return new Vec(x-p.x, y-p.y, z-p.z); }
-        public P plus(Vec v) { return new P(x+v.x, y+v.y, z+v.z); }
-        public boolean equals(Object o) { return o!=null && (o instanceof P) && ((P)o).x==x && ((P)o).y==y && ((P)o).z==z; }
+        public Point times(M m) { return m.times(this); }
+        public Vec minus(Point p) { return new Vec(x-p.x, y-p.y, z-p.z); }
+        public Point plus(Vec v) { return new Point(x+v.x, y+v.y, z+v.z); }
+        public boolean equals(Object o) { return o!=null && (o instanceof Point) && ((Point)o).x==x && ((Point)o).y==y && ((Point)o).z==z; }
         public void glVertex(GL gl) { _glVertex(gl); }
         private void _glVertex(GL gl) { gl.glVertex3f(x, y, z); }
         public String toString() { return "("+x+","+y+","+z+")"; }
@@ -705,7 +705,7 @@ public class Geom implements Iterable<Geom.T> {
         public final float x, y, z;
         public Vec(double x, double y, double z) { this((float)x, (float)y, (float)z); }
         public Vec(float x, float y, float z) { this.x = x; this.y = y; this.z = z; }
-        public Vec(P p1, P p2) { this(p2.x-p1.x, p2.y-p1.y, p2.z-p1.z); }
+        public Vec(Point p1, Point p2) { this(p2.x-p1.x, p2.y-p1.y, p2.z-p1.z); }
         public Vec cross(Vec v) { return new Vec(y*v.z-z*v.y, z*v.x-x*v.z, x*v.y-y*v.x); }
         public Vec plus(Vec v) { return new Vec(x+v.x, y+v.y, z+v.z); }
         public Vec norm() { return mag()==0 ? this : div(mag()); }
@@ -770,12 +770,12 @@ public class Geom implements Iterable<Geom.T> {
             g = (float)(tmp1 - tmp2);
             d = h = l = 0;
         }
-        public P times(P p) {
-            return new P(a*p.x + b*p.y + c*p.z + d,
+        public Point times(Point p) {
+            return new Point(a*p.x + b*p.y + c*p.z + d,
                         e*p.x + f*p.y + g*p.z + h,
                         i*p.x + j*p.y + k*p.z + l);
         }
-        public P apply(P p) { return p; }
+        public Point apply(Point p) { return p; }
         public Vec apply(Vec v) { return v; }
         public M invert() { return this; }
         public M times(M m) { return this; }
index 65c6c2a..8607e0a 100644 (file)
@@ -5,6 +5,7 @@ import javax.swing.*;
 import javax.media.opengl.*;
 import javax.media.opengl.glu.*;
 import java.util.*;
+import static edu.berkeley.qfat.Geom.*;
 
 // FIXME: recenter goal to have centroid coincident with tile
 // FIXME: re-orient goal (how?)
@@ -17,7 +18,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
     boolean control = false;
 
     public void mouseWheelMoved(MouseWheelEvent e) {
-        tz -= e.getWheelRotation() ;
+        tz -= e.getWheelRotation();
     }
 
     public void keyTyped(KeyEvent e)  { }
@@ -73,14 +74,14 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
     private static final float MAG = 1;
 
     Geom.M[] translations;
-    Geom.V[] points;
+    Geom.Vert[] points;
 
     public Main(StlFile stlf) {
 
         for(int i=0; i<stlf.coordArray.length; i+=3) {
-            Geom.V p0 = goal.register(new Geom.P(stlf.coordArray[i+0].x * MAG, stlf.coordArray[i+0].y * MAG, stlf.coordArray[i+0].z * MAG));
-            Geom.V p1 = goal.register(new Geom.P(stlf.coordArray[i+1].x * MAG, stlf.coordArray[i+1].y * MAG, stlf.coordArray[i+1].z * MAG));
-            Geom.V p2 = goal.register(new Geom.P(stlf.coordArray[i+2].x * MAG, stlf.coordArray[i+2].y * MAG, stlf.coordArray[i+2].z * MAG));
+            Geom.Vert p0 = goal.register(new Geom.Point(stlf.coordArray[i+0].x * MAG, stlf.coordArray[i+0].y * MAG, stlf.coordArray[i+0].z * MAG));
+            Geom.Vert p1 = goal.register(new Geom.Point(stlf.coordArray[i+1].x * MAG, stlf.coordArray[i+1].y * MAG, stlf.coordArray[i+1].z * MAG));
+            Geom.Vert p2 = goal.register(new Geom.Point(stlf.coordArray[i+2].x * MAG, stlf.coordArray[i+2].y * MAG, stlf.coordArray[i+2].z * MAG));
             Geom.Vec n  = new Geom.Vec(stlf.normArray[i/3].x * MAG, stlf.normArray[i/3].y  * MAG, stlf.normArray[i/3].z * MAG);
             Geom.T t  = goal.newT(p0, p1, p2, n);
         }
@@ -116,20 +117,20 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
         };
 
 
-        Geom.V ltf = tile.register(new Geom.P(-(width/2),  (height/2),  (depth/2)));
-        Geom.V mtf = tile.register(new Geom.P( 0.0,        (height/2),  (depth/2)));
-        Geom.V rtf = tile.register(new Geom.P( (width/2),  (height/2),  (depth/2)));
-        Geom.V ltn = tile.register(new Geom.P(-(width/2),  (height/2), -(depth/2)));
-        Geom.V mtn = tile.register(new Geom.P( 0.0,        (height/2), -(depth/2)));
-        Geom.V rtn = tile.register(new Geom.P( (width/2),  (height/2), -(depth/2)));
-        Geom.V lbf = tile.register(new Geom.P(-(width/2), -(height/2),  (depth/2)));
-        Geom.V mbf = tile.register(new Geom.P( 0.0,       -(height/2),  (depth/2)));
-        Geom.V rbf = tile.register(new Geom.P( (width/2), -(height/2),  (depth/2)));
-        Geom.V lbn = tile.register(new Geom.P(-(width/2), -(height/2), -(depth/2)));
-        Geom.V mbn = tile.register(new Geom.P( 0.0,       -(height/2), -(depth/2)));
-        Geom.V rbn = tile.register(new Geom.P( (width/2), -(height/2), -(depth/2)));
+        Geom.Vert ltf = tile.register(new Geom.Point(-(width/2),  (height/2),  (depth/2)));
+        Geom.Vert mtf = tile.register(new Geom.Point( 0.0,        (height/2),  (depth/2)));
+        Geom.Vert rtf = tile.register(new Geom.Point( (width/2),  (height/2),  (depth/2)));
+        Geom.Vert ltn = tile.register(new Geom.Point(-(width/2),  (height/2), -(depth/2)));
+        Geom.Vert mtn = tile.register(new Geom.Point( 0.0,        (height/2), -(depth/2)));
+        Geom.Vert rtn = tile.register(new Geom.Point( (width/2),  (height/2), -(depth/2)));
+        Geom.Vert lbf = tile.register(new Geom.Point(-(width/2), -(height/2),  (depth/2)));
+        Geom.Vert mbf = tile.register(new Geom.Point( 0.0,       -(height/2),  (depth/2)));
+        Geom.Vert rbf = tile.register(new Geom.Point( (width/2), -(height/2),  (depth/2)));
+        Geom.Vert lbn = tile.register(new Geom.Point(-(width/2), -(height/2), -(depth/2)));
+        Geom.Vert mbn = tile.register(new Geom.Point( 0.0,       -(height/2), -(depth/2)));
+        Geom.Vert rbn = tile.register(new Geom.Point( (width/2), -(height/2), -(depth/2)));
         
-        points = new Geom.V[] {
+        points = new Geom.Vert[] {
             ltf,
             mtf,
             rtf,
@@ -207,7 +208,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
             }
         }
 
-        //xGeom.V mid = lbf.getE(mbn).shatter();
+        //xGeom.Vert mid = lbf.getE(mbn).shatter();
 
         // rescale to match volume
         float factor = (float)Math.pow(tile.volume() / goal.volume(), 1.0/3.0);
@@ -252,7 +253,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
         }
     }
 
-    public synchronized void rand(double temperature, Geom.V p) {
+    public synchronized void rand(double temperature, Geom.Vert p) {
         double tile_score = tile.score();
         double goal_score = goal.score();
         
@@ -352,7 +353,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
             //if (v1.z==0 && v1.y==0) continue;
             i++;
             if (i != 1 /*&& i!=4*/) continue;
-            Geom.P p = new Geom.P(0, 0, 0).times(m);
+            Geom.Point p = new Geom.Point(0, 0, 0).times(m);
             Geom.Vec v = new Geom.Vec(p.x, p.y, p.z);
             v = v.times((float)1.04);
             gl.glTranslatef(v.x, v.y, v.z);
@@ -397,7 +398,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
                 gl.glEnd();
             }
 
-            Geom.P centroid = t.centroid();
+            Geom.Point centroid = t.centroid();
             gl.glBegin(GL.GL_LINES);
             gl.glColor3f(1, 1, 1);
             /*
@@ -406,7 +407,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
             */
 
             if (mesh==goal)
-                for(Geom.V p : new Geom.V[] { t.p1(), t.p2(), t.p3() }) {
+                for(Geom.Vert p : new Geom.Vert[] { t.p1(), t.p2(), t.p3() }) {
                     p.p.glVertex(gl);
                     //p.plus(p.norm().times(p.score()*10)).glVertex(gl);
                     p.partner().p.glVertex(gl);
@@ -448,7 +449,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener
                 glcanvas.repaint();
                 //tile.ts.get(Math.abs(random.nextInt()) % tile.ts.size()).e1().p1
                 for(Geom.T t : tile)
-                    for(Geom.V p : new Geom.V[] { t.p1(), t.p2(), t.p3() }) {
+                    for(Geom.Vert p : new Geom.Vert[] { t.p1(), t.p2(), t.p3() }) {
                         rand(10,p);
                     }
                 goal.rescore();