X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=DanUtil.pde;h=4d922940fa907b1e47bd48c0f4060976d2fae5df;hb=abef24f48dae8871ae89979836569cc07e693d2a;hp=097c61f38598afd49e1ad284310122444e6f3d6d;hpb=24fc03308b0fe0ee37c0143ce0e3c868a1a971be;p=SugarCubes.git diff --git a/DanUtil.pde b/DanUtil.pde index 097c61f..4d92294 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -6,8 +6,9 @@ boolean btwn (int a,int b,int c) { return a >= b && a <= c; } boolean btwn (double a,double b,double c) { return a >= b && a <= c; } float interp (float a, float b, float c) { return (1-a)*b + a*c; } float randctr (float a) { return random(a) - a*.5; } -float min (float a, float b, float c, float d) { return min(min(a,b),min(c,d)); } -float pointDist(Point p1, Point p2) { return dist(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z); } +float min (float a, float b, float c, float d) { return min(min(a,b),min(c,d)); } +float pointDist(Point p1, Point p2) { return dist(p1.x,p1.y,p1.z,p2.x,p2.y,p2.z); } +float xyDist (Point p1, Point p2) { return dist(p1.x,p1.y,p2.x,p2.y); } float distToSeg(float x, float y, float x1, float y1, float x2, float y2) { float A = x - x1, B = y - y1, C = x2 - x1, D = y2 - y1; float dot = A * C + B * D, len_sq = C * C + D * D; @@ -57,12 +58,6 @@ public class DBool { } } -public class DParam extends BasicParameter { - double dflt; - DParam (String label, double value) { super(label,value); dflt=value; } - void set (double value) { super.setValue(value); } - float Val () { return getValuef(); } -} //---------------------------------------------------------------------------------------------------------------------------------- public class xyz { float x,y,z; // extends pVector; eliminate half of the functions xyz() {x=y=z=0;} @@ -111,7 +106,6 @@ public class DPat extends SCPattern { ArrayList picks = new ArrayList (); ArrayList bools = new ArrayList (); - ArrayList params = new ArrayList(); MidiOutput APCOut; int nMaxRow = 53; @@ -121,9 +115,9 @@ public class DPat extends SCPattern xyz xyzJog = new xyz(), vT1 = new xyz(), vT2 = new xyz(); xyz modmin; - float NoiseMove = random(10000); - DParam pSpark, pWave, pRotX, pRotY, pRotZ, pSpin, pTransX, pTransY; - DBool pXsym, pYsym, pRsym, pXdup, pXtrip, pJog, pGrey; + float NoiseMove = random(10000); + BasicParameter pSpark, pWave, pRotX, pRotY, pRotZ, pSpin, pTransX, pTransY; + DBool pXsym, pYsym, pRsym, pXdup, pXtrip, pJog, pGrey; float lxh () { return lx.getBaseHuef(); } int c1c (float a) { return round(100*constrain(a,0,1)); } @@ -132,15 +126,12 @@ public class DPat extends SCPattern float CalcCone (xyz v1, xyz v2, xyz c) { vT1.set(v1); vT2.set(v2); vT1.subtract(c); vT2.subtract(c); return degrees( acos ( vT1.dot(vT2) / (sqrt(vT1.dot(vT1)) * sqrt(vT2.dot(vT2)) ) )); } - void StartRun(double deltaMs) { } - color CalcPoint(xyz p) { return lx.hsb(0,0,0); } - color blend3(color c1, color c2, color c3){ return blendColor(c1,blendColor(c2,c3,ADD),ADD); } + void StartRun(double deltaMs) { } + color CalcPoint(xyz p) { return lx.hsb(0,0,0); } + color blend3(color c1, color c2, color c3){ return blendColor(c1,blendColor(c2,c3,ADD),ADD); } + float val (BasicParameter p) { return p.getValuef(); } - DParam addParam(String label, double value) { - DParam P = new DParam(label, value); - super.addParameter(P); - params.add(P); return P; - } + BasicParameter addParam(String label, double value) { return new BasicParameter(label, value); } Pick addPick(String name, int def, int _max, String[] desc) { Pick P = new Pick(name, def, _max+1, nMaxRow, desc); @@ -165,7 +156,6 @@ public class DPat extends SCPattern void onInactive() { uiDebugText.setText(""); } void onReset() { - for (int i=0; i 0) { for (int i=0; i5) continue; addTurn(v0(s1), pos1, v0(s2), pos2); addTurn(v1(s1), 15-pos1, v0(s2), pos2); addTurn(v0(s2), pos2, v0(s1), pos1); addTurn(v1(s2), 15-pos2, v0(s1), pos1); - }} } }