X-Git-Url: http://git.megacz.com/?p=anneal.git;a=blobdiff_plain;f=src%2FMain.java;h=e97f97547121ada84696cf9f983d3fe1f9319f24;hp=da616df66d77859ac43a00062c2a79f81e6eacc3;hb=207c278791e5d7b53cdb099cb67bb5df713e59d9;hpb=c257689076da7472ec2aff9d5d940647715ecf08 diff --git a/src/Main.java b/src/Main.java index da616df..e97f975 100644 --- a/src/Main.java +++ b/src/Main.java @@ -4,6 +4,8 @@ import javax.swing.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; +// FEATURE: check google's 3D warehouse for sample shapes + public class Main implements GLEventListener { private Geom geom = new Geom(); @@ -16,6 +18,7 @@ public class Main implements GLEventListener { public Main(StlFile stlf) { + Geom.P ltf = geom.newP(-0.2, 0.1, 0.1); Geom.P mtf = geom.newP( 0.0, 0.1, 0.1); Geom.P rtf = geom.newP( 0.2, 0.1, 0.1); @@ -55,17 +58,6 @@ public class Main implements GLEventListener { geom.new V( 0, 0, -0.2), }; - for(Geom.V v : translations) { - for(Geom.P p1 : points) { - for(Geom.P p2 : points) { - if (p1.plus(v).minus(p2).mag() < Geom.EPSILON) { - System.out.println("bind " + p1 + " to " + p2); - p1.bind(p2); - } - } - } - } - // top geom.newT(ltf, mtf, mtn); geom.newT(mtn, ltn, ltf); @@ -98,8 +90,39 @@ public class Main implements GLEventListener { geom.newT(rtf, mtf, rbf); geom.newT(rbf, mtf, mbf); + for(Geom.V v : translations) { + for(Geom.T t1 : geom) { + for(Geom.T t2 : geom) { + if (t1==t2) continue; + + if ((t1.p1().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && + (t1.p2().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && + (t1.p3().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) + t1.bind(t2, 0); + if ((t1.p2().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && + (t1.p3().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && + (t1.p1().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) + t1.bind(t2, 1); + if ((t1.p3().plus(v).minus(t2.p1()).mag() < Geom.EPSILON) && + (t1.p1().plus(v).minus(t2.p3()).mag() < Geom.EPSILON) && + (t1.p2().plus(v).minus(t2.p2()).mag() < Geom.EPSILON)) + t1.bind(t2, 2); + } + } + } + + //Geom.P mid = geom.newE(ltf, lbn).shatter(); + + //tx.e2.shatter(); + //tx.e3.shatter(); + + //mid.move(geom.new V((float)-0.05,0,0)); + + //mtf.move(geom.new V(0, (float)-0.05, (float)0.05)); + mtf.move(geom.new V(0, (float)-0.05, (float)0.00)); /* + for(int i=0; i