X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2FMain.java;h=8b97bf36e1117672acc76bf32ae83a4001a22b20;hp=c789e0fb351360123e980ea26de37909abe51b12;hb=4b43602a6590a8c44a42e6d68cc1c33a4429eb4e;hpb=6b3895c2802157bfaab8d629c9870790d763001f diff --git a/src/Main.java b/src/Main.java index c789e0f..8b97bf3 100644 --- a/src/Main.java +++ b/src/Main.java @@ -72,63 +72,63 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener private static final float MAG = 1; Geom.M[] translations; - Geom.P[] points; + Geom.V[] points; public Main(StlFile stlf) { for(int i=0; i 20) return; + if (verts > 300) return; //double min = (tile.avgedge/tile.numedges)*(1+(4/(double)verts)); //if (verts>0 && tile.es.peek().length() < min) return; PriorityQueue es = new PriorityQueue(); @@ -251,7 +251,7 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener } } - public synchronized void rand(double temperature, Geom.P p) { + public synchronized void rand(double temperature, Geom.V p) { double tile_score = tile.score(); double goal_score = goal.score(); @@ -261,19 +261,21 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener r1 = r1 - (float)Math.floor(r1); r1 = r1 * (float)0.01; r1 = r1 - (float)0.005; - Geom.V v = p.watchback().minus(p).norm().times(r1); + Geom.Vec v = p.watchback().p.minus(p.p).norm().times(r1); //v = p.norm().times(v.dot(p.norm())); boolean aspect = false;//(Math.abs(random.nextInt()) % 100) <= 2; - Geom.M old_tile_aspect = goal.aspect; + Geom.M old_tile_aspect = null;//goal.aspect; boolean good = true; if (aspect) { + /* v = v.times(10); - tile.aspect = tile.new M(tile.aspect.a / (v.x+1), tile.aspect.f / (v.y+1), tile.aspect.k / (v.z+1)); - tile.invaspect = tile.new M(1/tile.aspect.a, 1/tile.aspect.f, 1/tile.aspect.k); + tile.aspect = new Geom.M(tile.aspect.a / (v.x+1), tile.aspect.f / (v.y+1), tile.aspect.k / (v.z+1)); + tile.invaspect = new Geom.M(1/tile.aspect.a, 1/tile.aspect.f, 1/tile.aspect.k); goal.rescore(); tile.rescore(); + */ } else { good = p.move(v); } @@ -292,8 +294,8 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener if (aspect) System.out.println("aspect " + v); } else { if (aspect) { - tile.aspect = old_tile_aspect; - tile.invaspect = tile.new M(1/tile.aspect.a, 1/tile.aspect.f, 1/tile.aspect.k); + //tile.aspect = old_tile_aspect; + //tile.invaspect = new Geom.M(1/tile.aspect.a, 1/tile.aspect.f, 1/tile.aspect.k); goal.rescore(); tile.rescore(); } else { @@ -349,8 +351,8 @@ 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 = tile.newP(0, 0, 0).times(m); - Geom.V v = tile.new V(p.x, p.y, p.z); + Geom.P p = new Geom.P(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); draw(gl, false, tile); @@ -385,12 +387,12 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener gl.glEnd(); } else { gl.glBegin(GL.GL_LINES); - t.e1().p1.glVertex(gl); - t.e1().p2.glVertex(gl); - t.e2().p1.glVertex(gl); - t.e2().p2.glVertex(gl); - t.e3().p1.glVertex(gl); - t.e3().p2.glVertex(gl); + t.e1().p1.p.glVertex(gl); + t.e1().p2.p.glVertex(gl); + t.e2().p1.p.glVertex(gl); + t.e2().p2.p.glVertex(gl); + t.e3().p1.p.glVertex(gl); + t.e3().p2.p.glVertex(gl); gl.glEnd(); } @@ -403,10 +405,10 @@ public class Main implements GLEventListener, MouseListener, MouseMotionListener */ if (mesh==goal) - for(Geom.P p : new Geom.P[] { t.p1(), t.p2(), t.p3() }) { - p.glVertex(gl); + for(Geom.V p : new Geom.V[] { t.p1(), t.p2(), t.p3() }) { + p.p.glVertex(gl); //p.plus(p.norm().times(p.score()*10)).glVertex(gl); - p.partner().glVertex(gl); + p.partner().p.glVertex(gl); //tile.nearest(p).centroid().glVertex(gl); } @@ -445,7 +447,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.P p : new Geom.P[] { t.p1(), t.p2(), t.p3() }) { + for(Geom.V p : new Geom.V[] { t.p1(), t.p2(), t.p3() }) { rand(10,p); } goal.rescore();