void run(double deltaMs) {
for (Point p : model.points) {
color c = img.get((int)((p.x / model.xMax) * img.width), img.height - (int)((p.y / model.yMax) * img.height));
- colors[p.index] = color(hue(c) + colorMod.getValuef()%360, saturation(c), brightness(c) - ((p.fz - brightMod.getValuef())/p.fz));
+ colors[p.index] = color(hue(c) + colorMod.getValuef()%360, saturation(c), brightness(c) - ((p.z - brightMod.getValuef())/p.z));
}
}
}
float x = model.xMax / 2 + cos(angle) * rad;
float y = model.yMax / 2 + sin(angle) * rad;
for (Point p : model.points) {
- float b = dist(x,y,p.fx,p.fy);
+ float b = dist(x,y,p.x,p.y);
if (b < 90) {
colors[p.index] = blendColor(
colors[p.index],
//----------------------------------------------------------------------------------------------------------------------------------
public class xyz { float x,y,z;
xyz() {x=y=z=0;}
- xyz(Point p ) {x=p.fx ; y=p.fy; z=p.fz;}
+ xyz(Point p ) {x=p.x ; y=p.y; z=p.z;}
xyz(xyz p ) {set(p); }
xyz(float _x,float _y,float _z) {x=_x ; y=_y ; z=_z ;}
- void set(Point p ) {x=p.fx ; y=p.fy; z=p.fz;}
+ void set(Point p ) {x=p.x ; y=p.y; z=p.z;}
void set(xyz p ) {x=p.x ; y=p.y ; z=p.z ;}
void set(float _x,float _y,float _z) {x=_x ; y=_y ; z=_z ;}
100 * b * DG._Level()
);
-// colors[p.index] = color(0,0, p.fx >= modmin.x && p.fy >= modmin.y && p.fz >= modmin.z &&
-// p.fx <= modmin.x+mMax.x && p.fy <= modmin.y+mMax.y && p.fz <= modmin.z+mMax.z ? 100 : 0);
+// colors[p.index] = color(0,0, p.x >= modmin.x && p.y >= modmin.y && p.z >= modmin.z &&
+// p.x <= modmin.x+mMax.x && p.y <= modmin.y+mMax.y && p.z <= modmin.z+mMax.z ? 100 : 0);
}
}
}
-//----------------------------------------------------------------------------------------------------------------------------------
\ No newline at end of file
+//----------------------------------------------------------------------------------------------------------------------------------
int i = 0;
for (Point p : strip.points) {
colors[p.index] = color(
- (lx.getBaseHuef() + 360 - p.fx*.2 + p.fy * .3) % 360,
+ (lx.getBaseHuef() + 360 - p.x*.2 + p.y * .3) % 360,
constrain(.4 * min(abs(s - sVal1), abs(s - sVal2)), 20, 100),
max(0, 100 - fVal*abs(i - pVal*(strip.metrics.numPoints - 1)))
);
for (Strip strip : model.strips ) {
int i = 0;
for (Point p : strip.points) {
- float fV = max(-1, 1 - dist(p.fx/2., p.fy, fX.getValuef()/2., fY.getValuef()) / 64.);
+ float fV = max(-1, 1 - dist(p.x/2., p.y, fX.getValuef()/2., fY.getValuef()) / 64.);
colors[p.index] = color(
- (lx.getBaseHuef() + 0.3 * abs(p.fx - hOffX.getValuef())) % 360,
+ (lx.getBaseHuef() + 0.3 * abs(p.x - hOffX.getValuef())) % 360,
constrain(80 + 40 * fV, 0, 100),
constrain(100 - (30 - fV * falloff.getValuef()) * modDist(i + (s*63)%61, offset.getValuef() * strip.metrics.numPoints, strip.metrics.numPoints), 0, 100)
);
float bleedf = 10 + bleed.getValuef() * 200.;
float xPos = (float) (-bleedf + progress * (model.xMax + bleedf));
for (Point p : model.points) {
- float d = (p.fx - xPos) / bleedf;
+ float d = (p.x - xPos) / bleedf;
if (d < 0) {
colors[p.index] = c2[p.index];
} else if (d > 1) {
float bassLevel = eq.getAverageLevel(0, 5);
for (Point p : model.points) {
- int avgIndex = (int) constrain(1 + abs(p.fx-model.xMax/2.)/(model.xMax/2.)*(eq.numBands-5), 0, eq.numBands-5);
+ int avgIndex = (int) constrain(1 + abs(p.x-model.xMax/2.)/(model.xMax/2.)*(eq.numBands-5), 0, eq.numBands-5);
float value = 0;
for (int i = avgIndex; i < avgIndex + 5; ++i) {
value += eq.getLevel(i);
}
value /= 5.;
- float b = constrain(8 * (value*model.yMax - abs(p.fy-model.yMax/2.)), 0, 100);
+ float b = constrain(8 * (value*model.yMax - abs(p.y-model.yMax/2.)), 0, 100);
colors[p.index] = color(
- (lx.getBaseHuef() + abs(p.fy - model.cy) + abs(p.fx - model.cx)) % 360,
- constrain(bassLevel*240 - .6*dist(p.fx, p.fy, model.cx, model.cy), 0, 100),
+ (lx.getBaseHuef() + abs(p.y - model.cy) + abs(p.x - model.cx)) % 360,
+ constrain(bassLevel*240 - .6*dist(p.x, p.y, model.cx, model.cy), 0, 100),
b
);
}
float clrConst = 1.1 + clr.getValuef();
for (Point p : model.points) {
- float avgIndex = constrain(2 + p.fx / model.xMax * (eq.numBands-4), 0, eq.numBands-4);
+ float avgIndex = constrain(2 + p.x / model.xMax * (eq.numBands-4), 0, eq.numBands-4);
int avgFloor = (int) avgIndex;
float leftVal = eq.getLevel(avgFloor);
float value = lerp(smoothValue, chunkyValue, blockiness.getValuef());
- float b = constrain(edgeConst * (value*model.yMax - p.fy), 0, 100);
+ float b = constrain(edgeConst * (value*model.yMax - p.y), 0, 100);
colors[p.index] = color(
- (480 + lx.getBaseHuef() - min(clrConst*p.fy, 120)) % 360,
+ (480 + lx.getBaseHuef() - min(clrConst*p.y, 120)) % 360,
100,
b
);
for (Point p : model.points) {
colors[p.index] = blendColor(
colors[p.index],
- color(huev, satv, constrain(brightv - falloffv*abs(boom.getValuef() - dist(p.fx, 2*p.fy, 3*p.fz, model.xMax/2, model.yMax, model.zMax*1.5)), 0, 100)),
+ color(huev, satv, constrain(brightv - falloffv*abs(boom.getValuef() - dist(p.x, 2*p.y, 3*p.z, model.xMax/2, model.yMax, model.zMax*1.5)), 0, 100)),
ADD);
}
}
for (Point p : model.points) {
color c = 0;
c = blendColor(c, color(
- (lx.getBaseHuef() + p.fx/10 + p.fy/3) % 360,
- constrain(140 - 1.1*abs(p.fx - model.xMax/2.), 0, 100),
- max(0, xlv - xwv*abs(p.fx - xv))
+ (lx.getBaseHuef() + p.x/10 + p.y/3) % 360,
+ constrain(140 - 1.1*abs(p.x - model.xMax/2.), 0, 100),
+ max(0, xlv - xwv*abs(p.x - xv))
), ADD);
c = blendColor(c, color(
- (lx.getBaseHuef() + 80 + p.fy/10) % 360,
- constrain(140 - 2.2*abs(p.fy - model.yMax/2.), 0, 100),
- max(0, ylv - ywv*abs(p.fy - yv))
+ (lx.getBaseHuef() + 80 + p.y/10) % 360,
+ constrain(140 - 2.2*abs(p.y - model.yMax/2.), 0, 100),
+ max(0, ylv - ywv*abs(p.y - yv))
), ADD);
c = blendColor(c, color(
- (lx.getBaseHuef() + 160 + p.fz / 10 + p.fy/2) % 360,
- constrain(140 - 2.2*abs(p.fz - model.zMax/2.), 0, 100),
- max(0, zlv - zwv*abs(p.fz - zv))
+ (lx.getBaseHuef() + 160 + p.z / 10 + p.y/2) % 360,
+ constrain(140 - 2.2*abs(p.z - model.zMax/2.), 0, 100),
+ max(0, zlv - zwv*abs(p.z - zv))
), ADD);
colors[p.index] = c;
}
float mv = m[si % m.length].getValuef();
for (Point p : strip.points) {
colors[p.index] = color(
- (hv + p.fz + p.fy*hs.getValuef()) % 360,
- min(100, abs(p.fx - s.getValuef())/2.),
+ (hv + p.z + p.y*hs.getValuef()) % 360,
+ min(100, abs(p.x - s.getValuef())/2.),
max(0, 100 - mv/2. - mv * abs(i - (strip.metrics.length-1)/2.))
);
++i;
for (Strip strip : model.strips) {
for (Point p : strip.points) {
colors[p.index] = color(
- (huev + i*constrain(cv, 0, 2) + p.fz/2. + p.fx/4.) % 360,
- min(100, abs(p.fy-sv)),
+ (huev + i*constrain(cv, 0, 2) + p.z/2. + p.x/4.) % 360,
+ min(100, abs(p.y-sv)),
max(0, 100 - 50*abs((i%NUM) - mv))
);
}
float d = MAX_FLOAT;
for (Plane plane : planes) {
if (plane.denom != 0) {
- d = min(d, abs(plane.av*(p.fx-model.cx) + plane.bv*(p.fy-model.cy) + plane.cv) / plane.denom);
+ d = min(d, abs(plane.av*(p.x-model.cx) + plane.bv*(p.y-model.cy) + plane.cv) / plane.denom);
}
}
colors[p.index] = color(
- (huev + abs(p.fx-model.cx)*.3 + p.fy*.8) % 360,
- max(0, 100 - .8*abs(p.fx - model.cx)),
+ (huev + abs(p.x-model.cx)*.3 + p.y*.8) % 360,
+ max(0, 100 - .8*abs(p.x - model.cx)),
constrain(140 - 10.*d, 0, 100)
);
}
float dv = d.getValuef();
float denom = sqrt(av*av + bv*bv + cv*cv);
for (Point p : model.points) {
- float d = abs(av*(p.fx-model.cx) + bv*(p.fy-model.cy) + cv*(p.fz-model.cz) + dv) / denom;
+ float d = abs(av*(p.x-model.cx) + bv*(p.y-model.cy) + cv*(p.z-model.cz) + dv) / denom;
colors[p.index] = color(
- (hv + abs(p.fx-model.cx)*.6 + abs(p.fy-model.cy)*.9 + abs(p.fz - model.cz)) % 360,
+ (hv + abs(p.x-model.cx)*.6 + abs(p.y-model.cy)*.9 + abs(p.z - model.cz)) % 360,
constrain(110 - d*6, 0, 100),
constrain(130 - 7*d, 0, 100)
);
colors[p.index] = color(
(360 + lx.getBaseHuef() + .8*abs(p.x-model.cx)) % 360,
100,
- constrain(9 * (bass[pos]*model.cy - abs(p.fy - model.cy)), 0, 100)
+ constrain(9 * (bass[pos]*model.cy - abs(p.y - model.cy)), 0, 100)
);
colors[p.index] = blendColor(colors[p.index], color(
(400 + lx.getBaseHuef() + .5*abs(p.x-model.cx)) % 360,
60,
- constrain(5 * (treble[pos]*.6*model.cy - abs(p.fy - model.cy)), 0, 100)
+ constrain(5 * (treble[pos]*.6*model.cy - abs(p.y - model.cy)), 0, 100)
), ADD);
}
// You can use abs() to determine the distance between two
// values. The further away this point is from an exact
// point, the more we decrease its brightness
- float bv = max(0, 100 - abs(p.fx - xPos.getValuef()));
+ float bv = max(0, 100 - abs(p.x - xPos.getValuef()));
colors[p.index] = color(hv, 100, bv);
}
}
public void run(double deltaMs) {
float hv = lx.getBaseHuef();
for (Point p : model.points) {
- float bv = max(0, 100 - abs(p.fy - yPos.getValuef()));
+ float bv = max(0, 100 - abs(p.y - yPos.getValuef()));
colors[p.index] = color(hv, 100, bv);
}
}
public void run(double deltaMs) {
float hv = lx.getBaseHuef();
for (Point p : model.points) {
- float bv = max(0, 100 - abs(p.fz - zPos.getValuef()));
+ float bv = max(0, 100 - abs(p.z - zPos.getValuef()));
colors[p.index] = color(hv, 100, bv);
}
}
}
float distanceTo(Point p) {
- return distanceTo(p.fx, p.fy, p.fz);
+ return distanceTo(p.x, p.y, p.z);
}
void add(Vector3 other, float multiplier) {
for (Point p : model.points) {
color c =
blendColor(
- color(210, 20, (float)Math.max(0, 1 - Math.pow((model.yMax - p.fy) / 10, 2)) * 50),
- color(220, 60, (float)Math.max(0, 1 - Math.pow((p.fy - model.yMin) / 10, 2)) * 100),
+ color(210, 20, (float)Math.max(0, 1 - Math.pow((model.yMax - p.y) / 10, 2)) * 50),
+ color(220, 60, (float)Math.max(0, 1 - Math.pow((p.y - model.yMin) / 10, 2)) * 100),
ADD);
for (Raindrop raindrop : raindrops) {
- if (p.fx >= (raindrop.p.x - raindrop.radius) && p.fx <= (raindrop.p.x + raindrop.radius) &&
- p.fy >= (raindrop.p.y - raindrop.radius) && p.fy <= (raindrop.p.y + raindrop.radius)) {
+ if (p.x >= (raindrop.p.x - raindrop.radius) && p.x <= (raindrop.p.x + raindrop.radius) &&
+ p.y >= (raindrop.p.y - raindrop.radius) && p.y <= (raindrop.p.y + raindrop.radius)) {
float d = raindrop.p.distanceTo(p) / raindrop.radius;
// float value = (float)Math.max(0, 1 - Math.pow(Math.min(0, d - raindrop.radius) / 5, 2));
if (d < 1) {
color c = 0;
for (Plane plane : planes) {
- normalizedPoint.x = p.fx - plane.center.x;
- normalizedPoint.y = p.fy - plane.center.y;
- normalizedPoint.z = p.fz - plane.center.z;
+ normalizedPoint.x = p.x - plane.center.x;
+ normalizedPoint.y = p.y - plane.center.y;
+ normalizedPoint.z = p.z - plane.center.z;
float v = plane.rotation.rotatedY(normalizedPoint);
float d = abs(v);
int value = 0;
for (Pinwheel pw : pinwheels) {
- value += (pw.isOnBlade(p.fx, p.fy - p.fz * zSlope) ? 1 : 0);
+ value += (pw.isOnBlade(p.x, p.y - p.z * zSlope) ? 1 : 0);
}
if (value == 1) {
values[i] = 1;
for (Strip s : model.strips) {
Vector3 v = new Vector3();
for (Point p : s.points) {
- v.add(p.fx, p.fy, p.fz);
+ v.add(p.x, p.y, p.z);
}
v.divide(s.points.size());
stripToCenter.put(s, v);
List<Strip> nearbyStrips = stripToNearbyStrips.get(s);
for (Point p : s.points) {
- Vector3 v = new Vector3(p.fx, p.fy, p.fz);
+ Vector3 v = new Vector3(p.x, p.y, p.z);
List<Point> neighbors = new ArrayList();
float closestPointDistance = 100000;
for (Point nsp : nearbyStrip.points) {
- float distance = v.distanceTo(nsp.fx, nsp.fy, nsp.fz);
+ float distance = v.distanceTo(nsp.x, nsp.y, nsp.z);
if (closestPoint == null || distance < closestPointDistance) {
closestPoint = nsp;
closestPointDistance = distance;
public void run(double deltaMs) {
for (Point p : model.points) {
- float hv = sin(dist(p.fx + pos, p.fy, 128.0, 128.0) / 8.0)
- + sin(dist(p.fx, p.fy, 64.0, 64.0) / 8.0)
- + sin(dist(p.fx, p.fy + pos / 7, 192.0, 64.0) / 7.0)
- + sin(dist(p.fx, p.fz + pos, 192.0, 100.0) / 8.0);
+ float hv = sin(dist(p.x + pos, p.y, 128.0, 128.0) / 8.0)
+ + sin(dist(p.x, p.y, 64.0, 64.0) / 8.0)
+ + sin(dist(p.x, p.y + pos / 7, 192.0, 64.0) / 7.0)
+ + sin(dist(p.x, p.z + pos, 192.0, 100.0) / 8.0);
float bv = 100;
colors[p.index] = color((hv+2)*50, satu, bv);
}
}
for (Point p : model.points) {
- int x = max(0,(int(p.fx)+int(p.fz))%xm);
- int y = constrain(ym-int(p.fy),0,ym-1);
+ int x = max(0,(int(p.x)+int(p.z))%xm);
+ int y = constrain(ym-int(p.y),0,ym-1);
colors[p.index] = flameColor(intensity[x][y]);
}
}
for (Strip strip : model.strips) {
for (int i=0;i<numOsc;i++) {
float avgdist=0.0;
- avgdist = dist(strip.points.get(8).fx,strip.points.get(8).fy,strip.points.get(8).fz,fX[i].getValuef(),fY[i].getValuef(),fZ[i].getValuef());
+ avgdist = dist(strip.points.get(8).x,strip.points.get(8).y,strip.points.get(8).z,fX[i].getValuef(),fY[i].getValuef(),fZ[i].getValuef());
boolean on = avgdist<30;
float hv = (lx.getBaseHuef()+colorOffset[i])%360;
float br = max(0,100-avgdist*4);
Strip s = c.strips.get(j);
if (j%4!=0 && j%4!=2) {
for (Point p : s.points) {
- int seq = int(p.fy*avgSize/model.yMax+pos.getValuef()+sin(p.fx+p.fz)*2)%avgSize;
+ int seq = int(p.y*avgSize/model.yMax+pos.getValuef()+sin(p.x+p.z)*2)%avgSize;
seq=min(abs(seq-(avgSize/2)),avgSize-1);
- colors[p.index] = color(200,max(0,100-abs(p.fx-col1.getValuef())/2),lightVals[seq]);
+ colors[p.index] = color(200,max(0,100-abs(p.x-col1.getValuef())/2),lightVals[seq]);
}
}
}
for (Point p : s.points) {
float dx, dz;
if (i%32 < 16) {
- dx = p.fx - (s.cx+xosc.getValuef());
- dz = p.fz - (s.cz+zosc.getValuef());
+ dx = p.x - (s.cx+xosc.getValuef());
+ dz = p.z - (s.cz+zosc.getValuef());
} else {
- dx = p.fx - (s.cx+zosc.getValuef());
- dz = p.fz - (s.cz+xosc.getValuef());
+ dx = p.x - (s.cx+zosc.getValuef());
+ dz = p.z - (s.cz+xosc.getValuef());
}
//println(dx);
- float a1=max(0,100-abs(p.fx-col1.getValuef()));
- float a2=max(0,100-abs(p.fx-col2.getValuef()));
+ float a1=max(0,100-abs(p.x-col1.getValuef()));
+ float a2=max(0,100-abs(p.x-col2.getValuef()));
float sat = max(a1,a2);
float h = (359*a1+200*a2) / (a1+a2);
colors[p.index] = color(h,sat,100-abs(dx*5)-abs(dz*5));
Strip s = c.strips.get(j);
if (j%4!=0 && j%4!=2) {
for (Point p : s.points) {
- float dis = (abs(p.fx-model.xMax/2)+pos.getValuef())%model.xMax/2;
+ float dis = (abs(p.x-model.xMax/2)+pos.getValuef())%model.xMax/2;
int seq = int((dis*avgSize*2)/model.xMax);
if (seq>avgSize) seq=avgSize-seq;
seq=constrain(seq,0,avgSize-1);
- float br=max(0, lightVals[seq]-p.fy);
+ float br=max(0, lightVals[seq]-p.y);
colors[p.index] = color((dis*avgSize*65)/model.xMax,90,br);
}
}
beginShape(POINTS);
for (Point p : glucose.model.points) {
stroke(colors[p.index]);
- vertex(p.fx, p.fy, p.fz);
+ vertex(p.x, p.y, p.z);
}
endShape();