+ color ellipsevalue(float px, float py, float pz , float f1xc, float f1yc, float f1zc, float f2xc, float f2yc, float f2zc)
+ {
+//switch(sShpape.cur() ) {}
+ return lx.hsb(huespread.getValuef()*5*px, dist(model.xMax-px, model.yMax-py, model.zMax-pz, f1xc, f1yc, f1zc) ,
+ max(0, 100 - 100*widthparameter.getValuef() *
+ abs( (dist(px, py, pz, f1xc, ybounce.getValuef(), f1zc) +
+ (dist(px, py , pz, f2xc, ybounce.getValuef(), f2zc) ) )/2
+ - 1.2*vibration.getValuef() ) ) ) ;
+ }
+
+void run(double deltaMs) {
+ float vv = vibration.getValuef();
+ float ybv = ybounce.getValuef();
+
+ }
+
+}
+
+// public boolean gridPressed(int row, int co){
+// midiengine.grid.setState();
+
+// return true;
+
+// }
+
+public boolean noteOn(Note note) {
+pitch= note.getPitch();
+velocity=note.getVelocity();
+channel=note.getChannel();
+return true;
+}
+
+public boolean gridPressed(int row, int col) {
+ pitch = row; channel = col;
+ cur = NumApcCols*(pitch-53)+col;
+//setState(row, col, 0 ? 1 : 0);
+return true;
+}
+
+//public grid
+final Sphery[] spherys;
+
+ SineSphere(LX lx)
+ {
+ super(lx);
+ println("modelrad " + modelrad);
+ sinespin = new LXProjection(model);
+ sinespin2 = new LXProjection(model);
+ sinespin3= new LXProjection(model);
+ addParameter(huespread);
+ addParameter(vibrationrate);
+ addParameter(widthparameter);
+ addParameter(rotationx);
+ addParameter(rotationy);
+ addParameter(rotationz);
+ addParameter(yrotspeed);
+ addParameter(yrot2speed);
+ addParameter(yrot3speed);
+ addParameter(vibration_magnitude);
+ addParameter(scale);
+ addModulator(yrot).trigger();
+ addModulator(yrot2).trigger();
+ addModulator(yrot3).trigger();
+
+
+ //addParameter(huespread);
+ //Sshape = addPick("Shape", , 1);
+ spherys = new Sphery[] {
+ new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/8, 3000),
+ new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/10, 2000),
+ new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/5, 2300),
+ new Sphery(.7*model.xMax, .65*model.yMax, .5*model.zMax, modelrad/7, 3500),
+ new Sphery(.75*model.xMax, .8*model.yMax, .7*model.zMax, modelrad/10, 2000),
+ new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/4, 2300),
+
+
+
+
+ // new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/16, modelrad/8, 3000),
+ // new Sphery(.75*model.xMax, model.yMax/2, model.zMax/2, modelrad/20, modelrad/10, 2000),
+ // new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/4, modelrad/8, 2300),
+
+ // new Sphery(.7*model.xMax, .65*model.yMax, .5*model.zMax, modelrad/14, modelrad/7, 3500),
+ // new Sphery(.75*model.xMax, .8*model.yMax, .7*model.zMax, modelrad/20, modelrad/10, 2000),
+ // new Sphery(model.xMax/2, model.yMax/2, model.zMax/2, modelrad/4, modelrad/8, 2300),
+
+ };
+ }
+
+// public void onParameterChanged(LXParameter parameter)
+// {
+
+
+// for (Sphery s : spherys) {
+// if (s == null) continue;
+// double bampv = s.bounceamp.getValue();
+// double brv = s.bouncerate.getValue();
+// double tempobounce = lx.tempo.bpm();
+// if (parameter == s.bounceamp)
+// {
+// s.ybounce.setRange(bampv*model.yMax/3 , bampv*2*model.yMax/3, brv);
+// }
+// else if ( parameter == s.bouncerate )
+// {
+// s.ybounce.setDuration(120000./tempobounce);
+// }
+// }
+// }
+
+ public void run( double deltaMs) {
+ float t = lx.tempo.rampf();
+ float bpm = lx.tempo.bpmf();
+ float scalevalue = scale.getValuef();
+
+
+ // switch (cur) {
+
+ // case 1: t = map(.5*t ,0,.5, 0,1); bpm = .5*bpm; break;
+
+ // case 2: t = t; bpm = bpm; break;
+
+ // case 3: t = map(2*t,0,2,0,1); bpm = 2*bpm; break;
+
+ // default: t= t; bpm = bpm;
+ // }
+
+ //switch(sphery.colorscheme)
+
+ for ( Sphery s: spherys){
+
+ //s.vibration.setBasis(t);
+ s.setVibrationPeriod(vibrationrate.getValuef());
+ // s.setVibrationMagnitude(vibration_magnitude.getValuef());
+
+ }
+
+
+ sinespin.reset()
+ // Translate so the center of the car is the origin, offset
+ .center()
+ .scale(scalevalue, scalevalue, scalevalue)
+ // Rotate around the origin (now the center of the car) about an y-vector
+ .rotate(yrot.getValuef(), rotationx.getValuef(), rotationy.getValuef() , rotationz.getValuef())
+ .translate(model.cx, model.cy, model.cz);
+
+