From: Mark Slee Date: Wed, 13 Nov 2013 10:58:24 +0000 (-0800) Subject: Update to new GLucose/HeronLX with transform/projection in HeronLX X-Git-Url: https://git.piment-noir.org/?p=SugarCubes.git;a=commitdiff_plain;h=9fa2981834188e15203b3e1f35949942af41a20e Update to new GLucose/HeronLX with transform/projection in HeronLX --- diff --git a/AlexGreen.pde b/AlexGreen.pde index b89aaa2..e8b55ce 100644 --- a/AlexGreen.pde +++ b/AlexGreen.pde @@ -1,6 +1,6 @@ class SineSphere extends SCPattern { private SinLFO yrot = new SinLFO(0, TWO_PI, 2000); - public final Projection sinespin; + public final LXProjection sinespin; float modelrad = sqrt((model.xMax)*(model.xMax) + (model.yMax)*(model.yMax) + (model.zMax)*(model.zMax)); Pick Sshape; public final PVector P = new PVector(); @@ -99,7 +99,7 @@ final Sphery[] spherys; SineSphere(GLucose glucose) { super(glucose); - sinespin = new Projection(model); + sinespin = new LXProjection(model); addModulator(yrot).trigger(); //Sshape = addPick("Shape", , 1); spherys = new Sphery[] { diff --git a/JR.pde b/JR.pde index cb8ba63..ba9498b 100644 --- a/JR.pde +++ b/JR.pde @@ -6,7 +6,7 @@ class Gimbal extends SCPattern { private final int MAXIMUM_BEATS_PER_REVOLUTION = 100; private boolean first_run = true; - private final Projection projection; + private final LXProjection projection; private final BasicParameter beatsPerRevolutionParam = new BasicParameter("SLOW", 20./MAXIMUM_BEATS_PER_REVOLUTION); private final BasicParameter hueDeltaParam = new BasicParameter("HUED", 60./360); private final BasicParameter fadeFromCoreParam = new BasicParameter("FADE", 1); @@ -21,7 +21,7 @@ class Gimbal extends SCPattern { Gimbal(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addParameter(beatsPerRevolutionParam); addParameter(hueDeltaParam); addParameter(fadeFromCoreParam); @@ -79,7 +79,7 @@ class Gimbal extends SCPattern { // Translate so the center of the car is the origin .center(); - for (Coord c : projection) { + for (LXVector c : projection) { //if (first_run) println(c.x + "," + c.y + "," + c.z); rotate3d(c, a, 0, 0); @@ -109,7 +109,7 @@ class Gimbal extends SCPattern { this.girth = girth; } - public color colorFor(Coord c) { + public color colorFor(LXVector c) { float theta = atan2(c.y, c.x); float nearest_circle_x = cos(theta) * radius; float nearest_circle_y = sin(theta) * radius; @@ -135,7 +135,7 @@ class Gimbal extends SCPattern { class Zebra extends SCPattern { - private final Projection projection; + private final LXProjection projection; SinLFO angleM = new SinLFO(0, PI * 2, 30000); /* @@ -146,12 +146,12 @@ class Zebra extends SCPattern { Zebra(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addModulator(angleM).trigger(); } - color colorFor(Coord c) { + color colorFor(LXVector c) { float hue = lx.getBaseHuef(); @@ -195,7 +195,7 @@ class Zebra extends SCPattern { // Translate so the center of the car is the origin .center(); - for (Coord c : projection) { + for (LXVector c : projection) { // rotate3d(c, a, b, g); colors[c.index] = colorFor(c); } @@ -215,7 +215,7 @@ class Zebra extends SCPattern { } -void rotate3d(Coord c, float a /* roll */, float b /* pitch */, float g /* yaw */) { +void rotate3d(LXVector c, float a /* roll */, float b /* pitch */, float g /* yaw */) { float cosa = cos(a); float cosb = cos(b); float cosg = cos(g); diff --git a/JackStahl.pde b/JackStahl.pde index dd60db7..862558c 100644 --- a/JackStahl.pde +++ b/JackStahl.pde @@ -9,7 +9,7 @@ class Swim extends SCPattern { // Projection stuff - private final Projection projection; + private final LXProjection projection; SawLFO rotation = new SawLFO(0, TWO_PI, 19000); SinLFO yPos = new SinLFO(-25, 25, 12323); final BasicParameter xAngle = new BasicParameter("XANG", 0.9); @@ -20,7 +20,7 @@ class Swim extends SCPattern { public Swim(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addParameter(xAngle); addParameter(yAngle); @@ -53,7 +53,7 @@ class Swim extends SCPattern { float model_height = model.yMax - model.yMin; float model_width = model.xMax - model.xMin; - for (Coord p : projection) { + for (LXVector p : projection) { float x_percentage = (p.x - model.xMin)/model_width; // Multiply by 1.4 to shrink the size of the sin wave to be less than the height of the cubes. @@ -83,7 +83,7 @@ class Balance extends SCPattern { // Projection stuff - private final Projection projection; + private final LXProjection projection; SinLFO sphere1Z = new SinLFO(0, 0, 15323); SinLFO sphere2Z = new SinLFO(0, 0, 8323); @@ -102,7 +102,7 @@ class Balance extends SCPattern { public Balance(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addParameter(hueScale); addParameter(phaseParam); @@ -162,7 +162,7 @@ class Balance extends SCPattern { .rotate(rotationX.getValuef() * crazy_factor, 0, 0, 1) .rotate(rotationY.getValuef() * crazy_factor, 0, 1, 0); - for (Coord p : projection) { + for (LXVector p : projection) { float x_percentage = (p.x - model.xMin)/modelWidth; float y_in_range = heightMod.getValuef() * (2*p.y - model.yMax - model.yMin) / modelHeight; diff --git a/TestPatterns.pde b/TestPatterns.pde index 62a1956..6a662f2 100644 --- a/TestPatterns.pde +++ b/TestPatterns.pde @@ -229,13 +229,13 @@ class TestTowerPattern extends TestPattern { */ class TestProjectionPattern extends TestPattern { - private final Projection projection; + private final LXProjection projection; private final SawLFO angle = new SawLFO(0, TWO_PI, 9000); private final SinLFO yPos = new SinLFO(-20, 40, 5000); public TestProjectionPattern(GLucose glucose) { super(glucose); - projection = new Projection(model); + projection = new LXProjection(model); addModulator(angle).trigger(); addModulator(yPos).trigger(); } @@ -256,7 +256,7 @@ class TestProjectionPattern extends TestPattern { .scale(1, 1.5, 1); float hv = lx.getBaseHuef(); - for (Coord c : projection) { + for (LXVector c : projection) { float d = sqrt(c.x*c.x + c.y*c.y + c.z*c.z); // distance from origin // d = abs(d-60) + max(0, abs(c.z) - 20); // life saver / ring thing d = max(0, abs(c.y) - 10 + .1*abs(c.z) + .02*abs(c.x)); // plane / spear thing diff --git a/_Internals.pde b/_Internals.pde index 8c50a76..847eeb6 100644 --- a/_Internals.pde +++ b/_Internals.pde @@ -18,13 +18,13 @@ import glucose.control.*; import glucose.effect.*; import glucose.model.*; import glucose.pattern.*; -import glucose.transform.*; import glucose.transition.*; import heronarts.lx.*; import heronarts.lx.control.*; import heronarts.lx.effect.*; import heronarts.lx.modulator.*; import heronarts.lx.pattern.*; +import heronarts.lx.transform.*; import heronarts.lx.transition.*; import ddf.minim.*; import ddf.minim.analysis.*; diff --git a/code/GLucose.jar b/code/GLucose.jar index 9440558..2321e33 100755 Binary files a/code/GLucose.jar and b/code/GLucose.jar differ diff --git a/code/HeronLX.jar b/code/HeronLX.jar index 86cb0a1..adb915b 100755 Binary files a/code/HeronLX.jar and b/code/HeronLX.jar differ