private static final float MAG = 1;
Geom.M[] translations;
- Geom.P[] points;
+ Geom.V[] points;
public Main(StlFile stlf) {
for(int i=0; i<stlf.coordArray.length; i+=3) {
- Geom.P p0 = goal.newP(stlf.coordArray[i+0].x * MAG, stlf.coordArray[i+0].y * MAG, stlf.coordArray[i+0].z * MAG);
- Geom.P p1 = goal.newP(stlf.coordArray[i+1].x * MAG, stlf.coordArray[i+1].y * MAG, stlf.coordArray[i+1].z * MAG);
- Geom.P p2 = goal.newP(stlf.coordArray[i+2].x * MAG, stlf.coordArray[i+2].y * MAG, stlf.coordArray[i+2].z * MAG);
+ Geom.V p0 = goal.newP(stlf.coordArray[i+0].x * MAG, stlf.coordArray[i+0].y * MAG, stlf.coordArray[i+0].z * MAG).register();
+ Geom.V p1 = goal.newP(stlf.coordArray[i+1].x * MAG, stlf.coordArray[i+1].y * MAG, stlf.coordArray[i+1].z * MAG).register();
+ Geom.V p2 = goal.newP(stlf.coordArray[i+2].x * MAG, stlf.coordArray[i+2].y * MAG, stlf.coordArray[i+2].z * MAG).register();
Geom.Vec n = goal.new 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);
}
};
- Geom.P ltf = tile.newP(-(width/2), (height/2), (depth/2));
- Geom.P mtf = tile.newP( 0.0, (height/2), (depth/2));
- Geom.P rtf = tile.newP( (width/2), (height/2), (depth/2));
- Geom.P ltn = tile.newP(-(width/2), (height/2), -(depth/2));
- Geom.P mtn = tile.newP( 0.0, (height/2), -(depth/2));
- Geom.P rtn = tile.newP( (width/2), (height/2), -(depth/2));
- Geom.P lbf = tile.newP(-(width/2), -(height/2), (depth/2));
- Geom.P mbf = tile.newP( 0.0, -(height/2), (depth/2));
- Geom.P rbf = tile.newP( (width/2), -(height/2), (depth/2));
- Geom.P lbn = tile.newP(-(width/2), -(height/2), -(depth/2));
- Geom.P mbn = tile.newP( 0.0, -(height/2), -(depth/2));
- Geom.P rbn = tile.newP( (width/2), -(height/2), -(depth/2));
+ Geom.V ltf = tile.newP(-(width/2), (height/2), (depth/2)).register();
+ Geom.V mtf = tile.newP( 0.0, (height/2), (depth/2)).register();
+ Geom.V rtf = tile.newP( (width/2), (height/2), (depth/2)).register();
+ Geom.V ltn = tile.newP(-(width/2), (height/2), -(depth/2)).register();
+ Geom.V mtn = tile.newP( 0.0, (height/2), -(depth/2)).register();
+ Geom.V rtn = tile.newP( (width/2), (height/2), -(depth/2)).register();
+ Geom.V lbf = tile.newP(-(width/2), -(height/2), (depth/2)).register();
+ Geom.V mbf = tile.newP( 0.0, -(height/2), (depth/2)).register();
+ Geom.V rbf = tile.newP( (width/2), -(height/2), (depth/2)).register();
+ Geom.V lbn = tile.newP(-(width/2), -(height/2), -(depth/2)).register();
+ Geom.V mbn = tile.newP( 0.0, -(height/2), -(depth/2)).register();
+ Geom.V rbn = tile.newP( (width/2), -(height/2), -(depth/2)).register();
- points = new Geom.P[] {
+ points = new Geom.V[] {
ltf,
mtf,
rtf,
}
}
- //xGeom.P mid = lbf.getE(mbn).shatter();
+ //xGeom.V mid = lbf.getE(mbn).shatter();
// rescale to match volume
float factor = (float)Math.pow(tile.volume() / goal.volume(), 1.0/3.0);
}
}
- 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();
//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);
goal.rescore();
tile.rescore();
+ */
} else {
good = p.move(v);
}
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 = tile.new M(1/tile.aspect.a, 1/tile.aspect.f, 1/tile.aspect.k);
goal.rescore();
tile.rescore();
} else {
//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 p = tile.newP(0, 0, 0).times(m).register();
Geom.Vec v = tile.new Vec(p.x, p.y, p.z);
v = v.times((float)1.04);
gl.glTranslatef(v.x, v.y, v.z);
gl.glEnd();
}
- Geom.P centroid = t.centroid();
+ Geom.V centroid = t.centroid().register();
gl.glBegin(GL.GL_LINES);
gl.glColor3f(1, 1, 1);
/*
*/
if (mesh==goal)
- 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() }) {
p.glVertex(gl);
//p.plus(p.norm().times(p.score()*10)).glVertex(gl);
p.partner().glVertex(gl);
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();