+ int spheremode = 0;
+
+ // void keyPressed() {
+ // spheremode++;
+ // }
+
+ color CalcPoint(xyz Px)
+ {
+ // if (spheremode == 0 )
+ //{
+ color c = 0;
+ c = blendColor(c, spherys[1].spheryvalue(Px.x, Px.y, Px.z, .75*model.xMax, model.yMax/2, model.zMax/2), ADD);
+ c = blendColor(c, spherys[0].spheryvalue(Px.x, Px.y, Px.z, model.xMax/4, model.yMax/4, model.zMax/2), ADD);
+ c = blendColor(c, spherys[2].spheryvalue(Px.x, Px.y, Px.z, model.xMax/2, model.yMax/2, model.zMax/2),ADD);
+ return c;
+ //}
+ // else if (spheremode == 1)
+ // {
+
+ // color c = 0;
+ // c = blendColor(c, spherys[3].ellipsevalue(Px.x, Px.y, Px.z, model.xMax/4, model.yMax/4, model.zMax/4, 3*model.xMax/4, 3*model.yMax/4, 3*model.zMax/4),ADD);
+ // return c;
+ // }
+ // return color(0,0,0);
+ // // else if(spheremode ==2)
+ // { color c = 0;
+ // return color(CalcCone( (xyz by = new xyz(0,spherys[2].ybounce.getValuef(),0) ), Px, mid) );
+
+ // }
+
+
+ }
+
+ }
+
+class CubeCurl extends SCPattern{
+float CH, CW;
+private SinLFO curl = new SinLFO(0, Cube.EDGE_HEIGHT, 5000 );
+
+private SinLFO bg = new SinLFO(180, 220, 3000);
+
+CubeCurl(GLucose glucose){
+super(glucose);
+addModulator(curl).trigger();
+addModulator(bg).trigger();
+ this.CH = Cube.EDGE_HEIGHT;
+ this.CW = Cube.EDGE_WIDTH;
+final float diag = sqrt(CH*CH + CW*CW + CW*CW);
+ArrayList<PVector> centerlist = new ArrayList<PVector>();
+
+for (int i = 0; i < model.cubes.size(); i++){
+ centerlist.add(centerofcube(i));
+ }
+
+}
+//there is definitely a better way of doing this!
+PVector centerofcube(int i) {
+Cube c = model.cubes.get(i);
+PVector cubeorigin = new PVector(c.x, c.y, c.z);
+PVector cubecenter = new PVector(c.x+ CW/2, c.y + CH/2, c.z + CW/2);
+PVector cubeangle = new PVector(c.rx, c.ry, c.rz);
+cubeangle.normalize();
+println( cubeangle.x + cubeangle.y + cubeangle.z);
+PVector cubecenterf = new PVector(cubecenter.x + tan(c.rx)*CW/2, cubecenter.y + tan(c.ry)*CH/2, cubecenter.z + tan(c.rz)*CW/2);