From: Alexander Green Date: Mon, 9 Dec 2013 08:50:26 +0000 (-0500) Subject: Apat and added acos to spherycolor, not included in color yet but working X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=8f4e6c99775f2724edf3cec488860eb68b06491c;p=SugarCubes.git Apat and added acos to spherycolor, not included in color yet but working --- diff --git a/AlexGreen.pde b/AlexGreen.pde index b1f1d96..3e164d8 100644 --- a/AlexGreen.pde +++ b/AlexGreen.pde @@ -19,7 +19,7 @@ class SineSphere extends APat { public final LXProjection sinespin2; public final LXProjection sinespin3; - Pick Galaxy, SpheryTime; + Pick Galaxy, STime; public BasicParameter rotationx = new BasicParameter("rotx", 0, 0, 1 ); public BasicParameter rotationy = new BasicParameter("roty", 1, 0, 1); @@ -41,7 +41,7 @@ class SineSphere extends APat { public BasicParameter bouncerate; public BasicParameter bounceamp; public BasicParameter vibrationrate; - public final PVector circlecenter = new PVector(); + public final PVector circlecenter; public Sphery(float f1xcenter, float f1ycenter, float f1zcenter, float radius, float vibration_magnitude , float vperiod) { @@ -49,6 +49,7 @@ class SineSphere extends APat { this.f1ycenter = f1ycenter; this.f1zcenter = f1zcenter; this.radius = radius; + this.circlecenter= new PVector(f1xcenter,f1ycenter,f1zcenter); this.vibration_magnitude = vibration_magnitude; @@ -123,6 +124,7 @@ float distfromcirclecenter(float px, float py, float pz, float f1x, float f1y, f float quadrant(PVector q) { float qtheta = atan2( (q.x-f1xcenter) , (q.z - f1zcenter) ); + float qphi = acos( (q.z-f1zcenter)/(PVector.dist(q,circlecenter)) ); return map(qtheta, -PI/2, PI/2, 200-huespread.getValuef(), 240+huespread.getValuef()); @@ -169,20 +171,26 @@ float distfromcirclecenter(float px, float py, float pz, float f1x, float f1y, f } +boolean noteOn(Note note) { + int row = note.getPitch(), col = note.getChannel(); + // if (row == 57) {KeyPressed = col; return true; } + return super.noteOn(note); + } -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 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; @@ -208,8 +216,8 @@ final Sphery[] spherys; addModulator(yrot).trigger(); addModulator(yrot2).trigger(); addModulator(yrot3).trigger(); - Galaxy = addPick("Galaxy", 1, 3, new String[] {"home", "vertical","single","aquarium"}); - SpheryTime =addPick("Time", 3, 4, new String[]{"half", "triplet", "beat", "2x", "3x" }); + //Galaxy = addPick("Galaxy", 1, 3, new String[] {"home", "vertical","single","aquarium"}); + STime =addPick("Time", 1, 4, new String[]{"half", "triplet", "beat", "2x", "3x" }); spherys = new Sphery[] { new Sphery(model.xMax/4, model.yMax/2, model.zMax/2, modelrad/12, modelrad/25, 3000), @@ -257,18 +265,19 @@ final Sphery[] spherys; float t = lx.tempo.rampf(); float bpm = lx.tempo.bpmf(); float scalevalue = scale.getValuef(); - + int spherytime= STime.Cur(); + - // switch (cur) { + switch (spherytime) { - // case 1: t = map(.5*t ,0,.5, 0,1); bpm = .5*bpm; break; + case 0: t = map(.5*t ,0,.5, 0,1); bpm = .5*bpm; break; - // case 2: t = t; bpm = bpm; break; + case 1: t = t; bpm = bpm; break; - // case 3: t = map(2*t,0,2,0,1); bpm = 2*bpm; break; + case 2: t = map(2*t,0,2,0,1); bpm = 2*bpm; break; - // default: t= t; bpm = bpm; - // } + default: t= t; bpm = bpm; + } //switch(sphery.colorscheme) @@ -369,8 +378,12 @@ final Sphery[] spherys; // } } +/*This just takes all of Dan Horwitz's code that I want to inherit and leaves the rest behind. + A work in progress. */ public class APat extends SCPattern + + { ArrayList picks = new ArrayList (); ArrayList bools = new ArrayList ();