+
+
+
+
+ for (LXVector p: sinespin)
+ // for (Point p: model.points)
+ {
+ P.set(p.x, p.y, p.z);
+ // PVector P = new PVector(p.x, p.y, p.z);
+ color c = #000000;
+ c = blendIfColor(c, spherys[1].spheryvalue(P), ADD);
+ c = blendIfColor(c, spherys[0].spheryvalue(P), ADD);
+ c = blendIfColor(c, spherys[2].spheryvalue(P),ADD);
+
+
+ colors[p.index] = c;
+
+
+ }
+ sinespin2.reset()
+ .center()
+ .scale(scalevalue,scalevalue,scalevalue)
+ .rotate(yrot2.getValuef(), rotationx.getValuef(), rotationy.getValuef() , rotationz.getValuef())
+ .translate(model.cx,model.cy,model.cz);
+
+ for (LXVector p: sinespin2)
+ { color c = 0;
+ // PVector P = new PVector(p.x, p.y, p.z);
+ P.set(p.x, p.y, p.z);
+ c = blendIfColor(c, spherys[3].spheryvalue(P),ADD);
+
+ colors[p.index] = blendIfColor(colors[p.index], c , ADD);
+
+ }
+ sinespin3.reset()
+ .center()
+ .scale(scalevalue,scalevalue,scalevalue)
+ .rotate(yrot3.getValuef(),-1 + rotationx.getValuef(), rotationy.getValuef(), rotationz.getValuef())
+ .translate(model.cx, model.cy, model.cz);
+ for (LXVector p: sinespin3)
+ { color c = 0;
+ // PVector P = new PVector(p.x, p.y, p.z);
+ P.set(p.x, p.y, p.z);
+ c = blendIfColor(c, spherys[4].spheryvalue(P),ADD);
+
+ colors[p.index] = blendIfColor(colors[p.index], c , ADD);
+
+ }
+
+
+
+ }
+
+ color blendIfColor(color c1, color c2, int mode) {
+ if (c2 != 0) {
+ return blendColor(c1, c2, mode);
+ }
+ return c1;
+ }
+
+
+ // 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 lx.hsb(0,0,0);
+ // // else if(spheremode ==2)
+ // { color c = 0;
+ // return lx.hsb(CalcCone( (xyz by = new xyz(0,spherys[2].ybounce.getValuef(),0) ), Px, mid) );
+
+ // }
+
+
+ // }
+
+ }
+
+class CubeCurl extends SCPattern{
+float CH, CW, diag;
+ArrayList<PVector> cubeorigin = new ArrayList<PVector>();
+ArrayList<PVector> centerlist = new ArrayList<PVector>();
+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;
+ this.diag = sqrt(CW*CW + CW*CW);
+
+
+ArrayList<PVector> centerlistrelative = new ArrayList<PVector>();
+for (int i = 0; i < model.cubes.size(); i++){
+ Cube a = model.cubes.get(i);
+ cubeorigin.add(new PVector(a.x, a.y, a.z));
+ centerlist.add(new PVector(a.cx, a.cy, a.cz) );
+
+}
+
+}
+//there is definitely a better way of doing this!
+PVector centerofcube(int i) {
+Cube c = model.cubes.get(i);
+PVector cubecenter = new PVector(c.cx, c.cy, c.cz);
+
+return cubecenter;
+}
+
+
+void run(double deltaMs){
+for (int i =0; i < model.cubes.size(); i++) {
+Cube c = model.cubes.get(i);
+float cfloor = c.y;
+
+// if (i%3 == 0){
+
+// for (LXPoint p : c.points ){
+// // colors[p.index]=color(0,0,0);
+// //float dif = (p.y - c.y);
+// //colors[p.index] = color( bg.getValuef() , 80 , dif < curl.getValuef() ? 80 : 0, ADD);
+// }
+// }
+
+// else if (i%3 == 1) {
+
+// for (LXPoint p: c.points){
+// colors[p.index]=color(0,0,0);
+// float dif = (p.y - c.y);
+// // colors[p.index] =
+// // color(bg.getValuef(),
+// // map(curl.getValuef(), 0, Cube.EDGE_HEIGHT, 20, 100),
+// // 100 - 10*abs(dif - curl.getValuef()), ADD );
+// }
+// }
+// else if (i%3 == 2){
+ // centerlist[i].sub(cubeorigin(i);
+ for (LXPoint p: c.points) {
+ PVector pv = new PVector(p.x, p.y, p.z);
+ colors[p.index] =color( constrain(4* pv.dist(centerlist.get(i)), 0, 360) , 50, 100 );
+ // colors[p.index] =color(constrain(centerlist[i].x, 0, 360), constrain(centerlist[i].y, 0, 100), );
+
+