X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=ShaheenGandhi.pde;h=83b97cf31bf356149d9bb9bd42d49a5292326294;hb=8f4e6c99775f2724edf3cec488860eb68b06491c;hp=2e9ead0005c425eaa0ff11b62b98b0028cd9554a;hpb=29674806c55d6280e15e3b92eb40266685a414b7;p=SugarCubes.git diff --git a/ShaheenGandhi.pde b/ShaheenGandhi.pde index 2e9ead0..83b97cf 100644 --- a/ShaheenGandhi.pde +++ b/ShaheenGandhi.pde @@ -103,7 +103,7 @@ class HelixPattern extends SCPattern { return phase; } - void step(int deltaMs) { + void step(double deltaMs) { // Rotate if (rotationPeriod != 0) { this.phase = (phase + ((float)deltaMs / (float)rotationPeriod) * TWO_PI); @@ -130,7 +130,7 @@ class HelixPattern extends SCPattern { // For performance reasons, cut out points that are outside of // the tube where the toroidal coil lives. if (abs(myDist(p, axisPoint) - radius) > girth*.5f) { - return color(0,0,0); + return lx.hsb(0,0,0); } // Find the appropriate point for the current rotation @@ -146,7 +146,7 @@ class HelixPattern extends SCPattern { // Soften edges by fading brightness. float b = constrain(100*(1 - ((d-.5*girth)/(girth*.5))), 0, 100); - return color((lx.getBaseHuef() + (360*(phase / TWO_PI)))%360, 80, b); + return lx.hsb((lx.getBaseHuef() + (360*(phase / TWO_PI)))%360, 80, b); } } @@ -232,7 +232,7 @@ class HelixPattern extends SCPattern { float t = axis.getTValue(pt) + spokePhase; int spokeIndex = (int)floor((t - tMin + spokePeriod/2) / spokePeriod); if (spokeIndex < 0 || spokeIndex >= basePairs.length) { - return color(0,0,0); + return lx.hsb(0,0,0); } BasePairInfo basePair = basePairs[spokeIndex]; Line spokeLine = basePair.line; @@ -240,10 +240,10 @@ class HelixPattern extends SCPattern { float d = PVector.dist(pt, pointOnSpoke); float b = (PVector.dist(pointOnSpoke, spokeLine.getPoint()) < spokeRadius) ? constrain(100*(1 - ((d-.5*spokeGirth)/(spokeGirth*.5))), 0, 100) : 0.f; float phase = spokeLine.getTValue(pointOnSpoke) < 0 ? basePair.colorPhase1 : basePair.colorPhase2; - return color((lx.getBaseHuef() + (360*(phase / TWO_PI)))%360, 80.f, b); + return lx.hsb((lx.getBaseHuef() + (360*(phase / TWO_PI)))%360, 80.f, b); } - void run(int deltaMs) { + void run(double deltaMs) { boolean h1on = helix1On.getValue() > 0.5; boolean h2on = helix2On.getValue() > 0.5; boolean spokesOn = (float)basePairsOn.getValue() > 0.5; @@ -252,22 +252,22 @@ class HelixPattern extends SCPattern { h2.step(deltaMs); calculateSpokes(); - for (Point p : model.points) { + for (LXPoint p : model.points) { PVector pt = new PVector(p.x,p.y,p.z); color h1c = h1.colorOfPoint(pt); color h2c = h2.colorOfPoint(pt); color spokeColor = calculateSpokeColor(pt); if (!h1on) { - h1c = color(0,0,0); + h1c = lx.hsb(0,0,0); } if (!h2on) { - h2c = color(0,0,0); + h2c = lx.hsb(0,0,0); } if (!spokesOn) { - spokeColor = color(0,0,0); + spokeColor = lx.hsb(0,0,0); } // The helices are positioned to not overlap. If that changes,