Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Plane folding
// Copyright by tsulej 2014, edited by Etienne Jacob
// click mouse to change drawing
void push() {
pushMatrix();
pushStyle();
}
void pop() {
popStyle();
popMatrix();
}
float step ;
Folds f;
int[] folds = new int[8];
int[] folds2 = new int[8];
void setup() {
size(500, 500);
colorMode(RGB, 255);
smooth();
noStroke();
//step = 0.25 / (2.0*width);
step=0.005;
textAlign(LEFT, TOP);
initialize();
println(constructName());
println(constructName2());
}
float start;
boolean go = true;
boolean dosinusoidal = true;
void mouseClicked() {
go = false;
initialize();
go = true;
}
int fnumber,fnumber2;
int nameSeed;
int iCurve = 0;
float alphaMax = 255;
void initialize() {
f = new Folds();
iCurve = 0;
iFrame = 0;
fill(255, 30);
stroke(255, alphaMax);
background(245);
nameSeed = int(random(10000000));
//dosinusoidal = random(1)<0.5?true:false;
dosinusoidal = false;
fnumber = (int)random(1, 4);
for (int i=0; i<fnumber; i++) {
folds[i]=(int)random(f.foldnames.length);
println("foldid="+folds[i]);
}
fnumber2 = (int)random(1, 4);
for (int i=0; i<fnumber2; i++) {
folds2[i]=(int)random(f.foldnames.length);
println("foldid="+folds2[i]);
}
}
String constructName() {
String r = "point -> ";
for (int n = fnumber-1; n>=0; n--) {
r += f.foldnames[folds[n]] + " -> ";
}
if (dosinusoidal) r+= "sinusoidal -> ";
return r + "point";
}
String constructName2() {
String r = "point -> ";
for (int n = fnumber2-1; n>=0; n--) {
r += f.foldnames[folds2[n]] + " -> ";
}
if (dosinusoidal) r+= "sinusoidal -> ";
return r + "point";
}
int numberOfCurves = 100;
int iFrame = 0;
int numFrames = 150;
int ncircle = 8;
float rmin = 0.1;
float rmax = 3.0;
void draw() {
background(0);
if (go) {
for (int iCurve=0; iCurve<numberOfCurves; iCurve++) {
float t = (1.0*iFrame/numFrames)%1;
float r = sqrt(1.0*iCurve/numberOfCurves)*map(iCurve, 0, numberOfCurves, rmin, rmax);
float s = alphaMax;
stroke(255, s);
for (float theta=0; theta<TWO_PI; theta+=TWO_PI/100) {
float x = r*cos(theta);
float y = r*sin(theta);
for(int i=0;i<ncircle;i++){
drawme(x, y, i, t);
}
}
}
saveFrame("fr"+String.format("%04d", iFrame)+".png");
iFrame++;
println(iFrame+"/"+numFrames);
if (iFrame == numFrames) {
go = false;
println("finished");
}
}
}
float easing_coeff = 1.3;
float ease(float p, float g) {
if (p < 0.5)
return 0.5 * pow(2*p, g);
else
return 1 - 0.5 * pow(2*(1 - p), g);
}
void drawme(float x, float y,int i,float time_) {
PVector p = new PVector(x, y);
float time = (i+time_)/ncircle;
PVector n = new PVector(0, 0);
switch(fnumber) {
case 1:
n.add( f.getFoldbyNo(folds[0], p, 1) );
break;
case 2:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], p, 1), 1) );
break;
case 3:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], p, 1), 1), 1) );
break;
case 4:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], f.getFoldbyNo(folds[3], p, 1), 1), 1), 1) );
break;
case 5:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], f.getFoldbyNo(folds[3], f.getFoldbyNo(folds[4], p, 1), 1), 1), 1), 1) );
break;
case 6:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], f.getFoldbyNo(folds[3], f.getFoldbyNo(folds[4], f.getFoldbyNo(folds[5], p, 1), 1), 1), 1), 1), 1) );
break;
case 7:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], f.getFoldbyNo(folds[3], f.getFoldbyNo(folds[4], f.getFoldbyNo(folds[5], f.getFoldbyNo(folds[6], p, 1), 1), 1), 1), 1), 1), 1) );
break;
case 8:
n.add( f.getFoldbyNo(folds[0], f.getFoldbyNo(folds[1], f.getFoldbyNo(folds[2], f.getFoldbyNo(folds[3], f.getFoldbyNo(folds[4], f.getFoldbyNo(folds[5], f.getFoldbyNo(folds[6], f.getFoldbyNo(folds[7], p, 1), 1), 1), 1), 1), 1), 1), 1) );
break;
}
PVector n2 = new PVector(0, 0);
switch(fnumber2) {
case 1:
n2.add( f.getFoldbyNo(folds2[0], p, 1) );
break;
case 2:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], p, 1), 1) );
break;
case 3:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], p, 1), 1), 1) );
break;
case 4:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], f.getFoldbyNo(folds2[3], p, 1), 1), 1), 1) );
break;
case 5:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], f.getFoldbyNo(folds2[3], f.getFoldbyNo(folds2[4], p, 1), 1), 1), 1), 1) );
break;
case 6:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], f.getFoldbyNo(folds2[3], f.getFoldbyNo(folds2[4], f.getFoldbyNo(folds2[5], p, 1), 1), 1), 1), 1), 1) );
break;
case 7:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], f.getFoldbyNo(folds2[3], f.getFoldbyNo(folds2[4], f.getFoldbyNo(folds2[5], f.getFoldbyNo(folds2[6], p, 1), 1), 1), 1), 1), 1), 1) );
break;
case 8:
n2.add( f.getFoldbyNo(folds2[0], f.getFoldbyNo(folds2[1], f.getFoldbyNo(folds2[2], f.getFoldbyNo(folds2[3], f.getFoldbyNo(folds2[4], f.getFoldbyNo(folds2[5], f.getFoldbyNo(folds2[6], f.getFoldbyNo(folds2[7], p, 1), 1), 1), 1), 1), 1), 1), 1) );
break;
}
PVector res = new PVector(0.0,0.0);
if(time<1.0/3){
float tt = ease(3*time,easing_coeff);
res = new PVector(lerp(p.x,n.x,tt),lerp(p.y,n.y,tt));
} else if(time<2.0/3) {
float tt = ease(3*time-1,easing_coeff);
res = new PVector(lerp(n.x,n2.x,tt),lerp(n.y,n2.y,tt));
} else {
float tt = ease(3*time-2,easing_coeff);
res = new PVector(lerp(n2.x,p.x,tt),lerp(n2.y,p.y,tt));
}
res.add( f.realgaussian(p, 0.002));
if (dosinusoidal)
res = f.sinusoidal(n, 1);
f.draw( res ,i, time_);//f.draw(p);
}
float nextGaussian = 0;
boolean haveNextGaussian = false;
/*
float randomGaussian() {
if(haveNextGaussian) {
haveNextGaussian = false;
return nextGaussian;
} else {
float v1,v2,s;
do {
v1 = 2 * random() - 1;
v2 = 2 * random() - 1;
s = v1 * v1 + v2 * v2;
} while (s >=1 || s == 0);
float mult = sqrt(-2 * log(s) / s);
nextGaussian = v2 * mult;
haveNextGaussian = true;
return v1 * mult;
}
}*/
final float cosh(float x) {
return 0.5 * (exp(x) + exp(-x));
}
final float sinh(float x) {
return 0.5 * (exp(x) - exp(-x));
}
final float tanh(float x) {
return sinh(x)/cosh(x);
}
final float safesqrt(float x) {
return (x<1e-10) ? 0.0 : sqrt(x);
}
final float sgn(float a) {
if(a == 0.0) return 0.0;
return a > 0.0 ? 1.0 : -1.0;
}
final float modulate(float amp, float freq, float x) {
return amp * cos(x * freq * TWO_PI);
}
final int bytemix (int a, int b) {
return ((a & 0x5A5A) ^ (b & 0xA5A5));
}
final int bytexim (int a, int b) { // variation...
return ((a & 0xAAAA) ^ (b & 0x5555));
}
final int byteshf (int a, int b) {
return ((a << 8) ^ (b >> 8) ) & 0xFFFF;
}
final int bytezhf (int a, int b) { // variation...
return ((a << 6) ^ (b >> 6)) & 0xFFFF;
}
final int byteprimes (int a, int b) { // variation...
return ((a * 857 - 4) & 0xFF00 ^ (-b * 977 + 8) & 0x00FF ) ;
}
final float acosh(float a) {
return log(a + sqrt(a-1) * sqrt(a+1));
}
final float random01() {
return random(0.0,1.0)<0.5?1.0:0.0;
}
final float M_SQRT5 = 2.2360679774997898;
final float M_PHI = 1.61803398874989484820;
final float FFIVE = 1.0 / M_SQRT5;
final float FNATLOG = log(M_PHI);
final float M_SQRT2 = sqrt(2.0);
final float HSQRT2 = sqrt(2.0) / 2.0;
public static class Jacobi_elliptic_result {
public float sn, cn, dn;
public void clear() {
sn = cn = dn = 0.0;
}
}
public void Jacobi_elliptic(float uu, float emmc, Jacobi_elliptic_result res) {
// Code is taken from IROIRO++ library,
// released under CC share-alike license.
res.clear();
// less accurate for faster rendering (still very precise)
final float CA = 0.0003; // (The accuracy is the square of CA.)
float a, b, c = 0.0, d = 0.0, em[] = new float[13], en[] = new float[13];
int bo;
int l = 0;
int ii;
int i;
// LOGICAL bo
// main
float emc = emmc;
float u = uu;
if (emc != 0.0) {
bo = 0;
if (emc < 0.0)
bo = 1;
if (bo != 0) {
d = 1.0 - emc;
emc = -emc / d;
d = sqrt(d);
u = d * u;
}
a = 1.0;
res.dn = 1.0;
for(i=0; i<13; i++){// original
//for (i = 0; i < 8; i++) {
l = i;
em[i] = a;
emc = sqrt(emc);
en[i] = emc;
c = 0.5 * (a + emc);
if (abs(a - emc) <= CA * a)
break;
emc = a * emc;
a = c;
}
u = c * u;
res.sn = sin(u);
res.cn = cos(u);
if (res.sn != 0.0) {
a = res.cn / res.sn;
c = a * c;
for (ii = l; ii >= 0; --ii) {
b = em[ii];
a = c * a;
c = res.dn * c;
res.dn = (en[ii] + a) / (b + a);
a = c / b;
}
a = 1.0 / sqrt(c * c + 1.0);
if (res.sn < 0.0)
(res.sn) = -a;
else
res.sn = a;
res.cn = c * (res.sn);
}
if (bo != 0) {
a = res.dn;
res.dn = res.cn;
res.cn = a;
res.sn = (res.sn) / d;
}
}
else {
res.cn = 1.0 / cosh(u);
res.dn = res.cn;
(res.sn) = tanh(u);
}
}
//VORONOI
final static short VORONOI_MAXPOINTS = 25;
float vratio(PVector P, PVector Q, PVector U) {
PVector tmp = new PVector(P.x, P.y);
tmp.sub(Q);
if (tmp.mag() == 0.0) return 1.0;
PVector tmp2 = new PVector(U.x, U.y);
tmp2.sub(Q);
return 2.0 * (tmp2.dot(tmp)) / tmp.magSq();
}
int closest( PVector[] P, int n, PVector U) {
float d2;
float d2min = 1.0e10;
int j=0;
for (int i=0; i<n; i++) {
PVector tmp = new PVector(P[i].x, P[i].y);
tmp.sub(U);
d2 = tmp.magSq();
if (d2 < d2min) {
d2min = d2;
j=i;
}
}
return j;
}
float voronoi( PVector[] P, int n, int q, PVector U) {
float ratio;
float ratiomax = -1.0e10;
for (int i=0; i<n; i++)
if (i!=q) {
ratio = vratio(P[i], P[q], U);
if (ratio > ratiomax) ratiomax = ratio;
}
return ratiomax;
}
class Hexes {
static final float a_hex = 1.0 / 3.0;
static final float b_hex = 1.7320508075688772935 / 3.0;
static final float c_hex = -1.0 / 3.0;
static final float d_hex = 1.7320508075688772935 / 3.0;
static final float a_cart = 1.5;
static final float b_cart = -1.5;
static final float c_cart = 1.7320508075688772935 / 2.0;
static final float d_cart = 1.7320508075688772935 / 2.0;
final PVector[] cell_choice= {
new PVector(-1, -1),
new PVector(-1, 0),
new PVector(-1, 1),
new PVector(0, -1),
new PVector(0, 0),
new PVector(0, 1),
new PVector(1, -1),
new PVector(1, 0),
new PVector(1, 1)
};
float cellsize, power, rotate, scale;
float rotSin, rotCos;
Hexes(float cs, float p, float r, float s) {
cellsize = cs;
power = p;
rotate = r;
scale = s;
rotSin = sin(rotate * TWO_PI);
rotCos = cos(rotate * TWO_PI);
}
PVector cell_centre(int x, int y, float s) {
float xx = (a_cart * x + b_cart * y) * s;
float yy = (c_cart * x + d_cart * y) * s;
return new PVector(xx,yy);
}
PVector transform(PVector p, float weight) {
PVector[] P = new PVector[VORONOI_MAXPOINTS];
PVector U = p.get();
int Hx = (int)floor((a_hex * U.x + b_hex * U.y) / cellsize);
int Hy = (int)floor((c_hex * U.x + d_hex * U.y) / cellsize);
int i=0;
for(int di =-1;di<2;di++) {
for(int dj =-1;dj<2;dj++) {
P[i] = cell_centre(Hx+di, Hy+dj, cellsize);
i++;
}
}
int q = closest(P,9,U);
Hx += cell_choice[q].x;
Hy += cell_choice[q].y;
P[0] = cell_centre(Hx,Hy,cellsize);
P[1] = cell_centre(Hx,Hy+1,cellsize);
P[2] = cell_centre(Hx+1,Hy+1,cellsize);
P[3] = cell_centre(Hx+1,Hy,cellsize);
P[4] = cell_centre(Hx,Hy-1,cellsize);
P[5] = cell_centre(Hx-1,Hy-1,cellsize);
P[6] = cell_centre(Hx-1,Hy,cellsize);
float L1 = voronoi(P,7,0,U);
PVector Do = U.get();
Do.sub(P[0]);
float trgL = pow(L1+ 1.0e-10, power) * scale;
PVector V = new PVector(Do.x * rotCos + Do.y * rotSin, -Do.x * rotSin + Do.y * rotCos);
U = V.get();
U.add(P[0]);
float L2 = voronoi(P,7,0,U);
float L = (L1 > L2) ? L1:L2;
float R;
if(L < 0.5) {
R = trgL/L1;
} else {
if(L>0.8) {
R = trgL / L2;
} else {
R = ((trgL / L1) * (0.8 - L) + (trgL / L2) * (L - 0.5)) / 0.3;
}
}
V.mult(R);
V.add(P[0]);
V.mult(weight);
return V;
}
}
class Crackle {
final static int CACHE_NUM = 10;
final static int CACHE_WIDTH = 21;
PVector[] points = new PVector[VORONOI_MAXPOINTS];
ArrayList<ArrayList<PVector>> c = new ArrayList<ArrayList<PVector>>();
final PVector[] offset= {
new PVector(-1, -1),
new PVector(-1, 0),
new PVector(-1, 1),
new PVector(0, -1),
new PVector(0, 0),
new PVector(0, 1),
new PVector(1, -1),
new PVector(1, 0),
new PVector(1, 1)
};
float z, s, d, power, scale;
Crackle(float zz, float ccellsize, float ddistort, float ppower, float sscale) {
super();
z = zz;
s = ccellsize/2.0;
power = ppower;
scale = sscale;
d = ddistort;
for (int x=-CACHE_NUM; x<=CACHE_NUM; x++) {
ArrayList<PVector> pv = new ArrayList<PVector>();
for (int y=-CACHE_NUM; y<=CACHE_NUM; y++) {
PVector v = position(x, y);
pv.add(v);
}
c.add(pv);
}
}
PVector position(int x, int y) {
PVector E = new PVector(2.5, 2.5, 2.5);
PVector F = new PVector(30.2, -12.1, 19.8);
PVector v = new PVector(x, y, z);
E.add(v);
F.add(E);
float xx = (x + d * noise(E.x, E.y, E.z)) * s;
float yy = (y + d * noise(F.x, F.y, F.z)) * s;
return new PVector(xx, yy);
}
PVector cached_position(int x, int y) {
if (abs(x) <= CACHE_NUM && abs(y) <= CACHE_NUM) {
return c.get(x+CACHE_NUM).get(y+CACHE_NUM);
} else {
return position(x, y);
}
}
PVector transform(PVector p, float weight) {
float blurr = p.mag();
float theta = atan2(p.x,p.y);
PVector U = new PVector(blurr * sin(theta), blurr * cos(theta));
int xcv = (int)floor(U.x/s);
int ycv = (int)floor(U.y/s);
int i=0;
for (int di=-1; di<2; di++)
for (int dj=-1; dj<2; dj++) {
PVector v = cached_position( xcv+di, ycv+dj);
points[i] = v;
i++;
}
int q = closest(points, 9, U);
xcv += offset[q].x;
ycv += offset[q].y;
i=0;
for (int di=-1; di<2; di++)
for (int dj=-1; dj<2; dj++) {
PVector v = cached_position( xcv+di, ycv+dj);
points[i] = v;
i++;
}
float L = voronoi(points, 9, 4, U);
U.sub(points[4]);
float R = (pow(L+1.0e-10, power) * scale) / (L + 1.0e-10);
U.mult(R);
U.add(points[4]);
U.mult(weight);
return U;
}
}
private static HashMap<String, ArrayList<PVector>> dlawf_cache = new HashMap<String, ArrayList<PVector>>();
class DLAWF {
int seed = 667776;
int maxiter = 4000;
int buffersize = 800;
float scale = 4.0;
DLAWF(float sseed, float mmaxiter, float bbuffersize, float sscale) {
seed = (int)sseed;
maxiter = (int)mmaxiter;
buffersize = (int)bbuffersize;
scale = sscale;
}
String makeKey() {
return buffersize + "_" + maxiter + "_" + seed;
}
PVector transform(PVector p, float weight) {
PVector point = getRandomPoint();
point.mult(weight);
return point;
}
PVector getRandomPoint() {
ArrayList<PVector> points = getPoints();
if(points.size() > 0) {
PVector v = points.get((int)(random(0,1) * points.size()));
return new PVector(v.x,v.y);
} else return new PVector(0,0);
}
ArrayList<PVector> getPoints() {
String key = makeKey();
ArrayList<PVector> res = dlawf_cache.get(key);
if(res == null) {
short[][] points = calculate();
res = new ArrayList<PVector>();
for (int i = 0; i < points.length; i++) {
for (int j = 0; j < points[i].length; j++) {
if (points[i][j] != 0) {
PVector point = new PVector();
point.x = (((float) (float(i) - buffersize / 2.0)) / (float) buffersize )* scale;
point.y = (((float) (float(j) - buffersize / 2.0)) / (float) buffersize )* scale;
res.add(point);
}
}
}
dlawf_cache.put(key, res);
}
return res;
}
short[][] calculate() {
int centre = buffersize / 2;
int size2 = buffersize - 2;
short q[][] = new short[buffersize][buffersize];
randomSeed(seed);
q[centre][centre] = 1;
float r1 = 3.0;
float r2 = 3.0 * r1;
for (int i = 0; i < maxiter; i++) {
float phi = TWO_PI * random(0,1);
float ri = r1 * cos(phi);
float rj = r1 * sin(phi);
int ci = centre + (int) (ri + 0.5);
int cj = centre + (int) (rj + 0.5);
short qt = 0;
while (qt == 0) {
float rr = random(0,1);
rr += rr;
rr += rr;
int rd = (int) rr;
switch (rd) {
case 0:
ci++;
break;
case 1:
cj--;
break;
case 2:
ci--;
break;
default:
cj++;
}
if ((ci < 1) || (ci > size2) || (cj < 1) || (cj > size2)) {
qt = 1;
i--;
}
else {
int sum = q[ci - 1][cj] + q[ci + 1][cj] + q[ci][cj - 1] + q[ci][cj + 1];
if (sum != 0) {
q[ci][cj] = qt = 1;
float r3 = (float) (ci - centre);
float r4 = (float) (cj - centre);
r3 *= r3;
r4 *= r4;
r3 += r4;
r3 = sqrt(r3);
if (r3 > r1) {
r1 = r3;
r2 = 2.1 * r1;
}
}
else {
float r3 = (float) (ci - centre);
float r4 = (float) (cj - centre);
r3 *= r3;
r4 *= r4;
r3 += r4;
r3 = sqrt(r3);
if (r3 > r2) {
qt = 1;
i--;
}
}
}
}
}
return q;
}
}
FloatDict getFoldsParameters() {
FloatDict f = new FloatDict();
f.set("lines_scale",random(0.01,0.5));
f.set("lines_squared",random(0,1) < 0.5 ? 1 : 0);
f.set("flower_petals",round(random(3,13)));
f.set("flower_holes",random(-0.2,1));
f.set("waves_b",random(-0.8,0.8));
f.set("waves_e",random(-0.8,0.8));
f.set("waves_c",random(-0.8,0.8));
f.set("waves_f",random(-0.8,0.8));
f.set("popcorn_c",random(-0.8,0.8));
f.set("popcorn_f",random(-0.8,0.8));
f.set("rings_c",random(-0.9,0.9));
f.set("fan_c",random(-0.9,0.9));
f.set("fan_f",random(-0.8,0.8));
f.set("blob_low",random(0.2,0.7));
f.set("blob_high",random(0.8,1.2));
f.set("blob_waves",round(random(2,7)));
f.set("pdj_a",random(-3.0,3.0));
f.set("pdj_b",random(-3.0,3.0));
f.set("pdj_c",random(-3.0,3.0));
f.set("pdj_d",random(-3.0,3.0));
f.set("fan2_x",random(-1,1));
f.set("fan2_y",random(2,7));
f.set("rings2_val",random(0.1,1.2));
f.set("perspective_angle",random(0.3,1.0));
f.set("perspective_dist",random(1.0,3.0));
f.set("julian_power",random(0,1)<0.5? (int)random(4,10) : -(int)random(4,10));
f.set("julian_dist",random(0.5,3.0));
f.set("juliascope_power",random(0,1)<0.5? (int)random(4,10) : -(int)random(4,10));
f.set("juliascope_dist",random(0.5,2.0));
f.set("radialblur_angle",HALF_PI * random(-1,1));
f.set("pie_slices",(int)random(3,10));
f.set("pie_rotation",random(-2,2));
f.set("pie_thickness",random(0.2,0.8));
f.set("ngon_sides",(int)random(3,9));
f.set("ngon_power",random(1.01, 4.0));
f.set("ngon_circle",random(0.5, 1.5));
f.set("ngon_corners",random(0.5, 1.5));
f.set("curl_c1",random(0.1,0.7));
f.set("curl_c2",random(0.1,0.7));
f.set("wedgejulia_count",(int)random(2,7));
f.set("wedgejulia_angle",random(-3,3));
f.set("wedgejulia_power",random(0,1)<0.5?(int)random(2,7):-(int)random(2,7));
f.set("wedgejulia_dist",random(1,4));
f.set("circus_size",random(0.2,1.2));
f.set("rectangles_x",random(0.1,1));
f.set("rectangles_y",random(0.1,1));
f.set("arch_weight",random(0.4,1));
f.set("rays_weight",random(0.4,1));
f.set("blade_weight",random(0.4,1));
f.set("secant_weight",random(0.4,1));
f.set("twintrian_weight",random(0.4,1));
f.set("disc2_rot",random(-2,2));
f.set("disc2_twist",random(-8,8));
f.set("supershape_rnd",random(1)<0.8?0:random(0,0.3));
f.set("supershape_m",random(1,20));
f.set("supershape_n1",random(0.5,20));
f.set("supershape_n2",random(0.5,20));
f.set("supershape_n3",random(0.5,20));
f.set("supershape_holes",random(-1,1));
f.set("conic_holes",random(0,1));
f.set("conic_eccentricity",random(0.3,1.0));
f.set("parabola_width",random(0,1) < 0.5 ? random(1,3) : -random(1,3));
f.set("parabola_height",random(0,1) < 0.5 ? random(1,3) : -random(1,3));
f.set("bent2_x",random(-1.5,1.5));
f.set("bent2_y",random(-1.5,1.5));
f.set("bipolar_shift",random(-1.5,1.5));
f.set("cell_size",random(-2.5,2.5));
f.set("cpow_r",random(1,3));
f.set("cpow_i",random(-0.25,0.25));
f.set("cpow_power",(int)random(1,5));
f.set("loonie_weight",random(0.8,1.6));
f.set("scry_weight",random(0.4,1));
f.set("curve_xamp",random(-2.5,2.5));
f.set("curve_yamp",random(-2.5,2.5));
f.set("curve_xlength",random(0.9,2.7));
f.set("curve_ylength",random(0.9,2.7));
f.set("escher_beta",random(-3,3));
f.set("lazysuzan_spin",random(-3,3));
f.set("lazysuzan_space",random(-1,2));
f.set("lazysuzan_twist",random(-2,2));
f.set("lazysuzan_x",random(-0.5,0.5));
f.set("lazysuzan_y",random(-0.5,0.5));
f.set("lazysuzan_weight",random(0.4,1));
f.set("modulus_x",random(0.8,1.5)*(random(0,1)<0.5?-1:1));
f.set("modulus_y",random(0.8,1.5)*(random(0,1)<0.5?-1:1));
f.set("oscilloscope_separation",random(0.01,2));
f.set("oscilloscope_frequency",random(-8,8));
f.set("oscilloscope_amplitude",random(0.4,3));
f.set("oscilloscope_damping",random(0,1));
f.set("popcorn2_x",random(-1,1));
f.set("popcorn2_y",random(-1,1));
f.set("popcorn2_c",random(-5,5));
f.set("separation_x",random(0,1));
f.set("separation_y",random(0,1));
f.set("separation_xinside",random(-1,1));
f.set("separation_yinside",random(-1,1));
f.set("split_xsize",random(-0.8,0.8));
f.set("split_ysize",random(-0.8,0.8));
f.set("splits_x",random(-1,1));
f.set("splits_y",random(-1,1));
f.set("stripes_space",random(-0.8,0.8));
f.set("stripes_warp",random(-4,4));
f.set("wedge_angle",random(-3,3));
f.set("wedge_hole",random(-0.5,0.5));
f.set("wedge_count",floor(random(1,6.9)));
f.set("wedge_swirl",random(-1,1));
f.set("wedgesph_angle",random(-3,3));
f.set("wedgesph_hole",random(-0.5,0.5));
f.set("wedgesph_count",floor(random(1,6.9)));
f.set("wedgesph_swirl",random(-1,1));
f.set("whorl_inside",random(-2,2));
f.set("whorl_outside",random(-2,2));
f.set("whorl_weight",random(0.8,2));
f.set("waves2_freqx",random(0.01,4));
f.set("waves2_freqy",random(0.01,4));
f.set("waves2_scalex",random(0.5,1.5));
f.set("waves2_scaley",random(0.5,1.5));
f.set("auger_freq",floor(random(3,7.9)));
f.set("auger_scale",random(0.1,0.8));
f.set("auger_sym",random(-1,1));
f.set("auger_weight",random(-1,1));
f.set("flux_spread",random(0.5,1));
f.set("flux_weight",random(0.4,1));
f.set("mobius_re_a",random(-1,1));
f.set("mobius_im_a",random(-1,1));
f.set("mobius_re_b",random(-1,1));
f.set("mobius_im_b",random(-1,1));
f.set("mobius_re_c",random(-1,1));
f.set("mobius_im_c",random(-1,1));
f.set("mobius_re_d",random(-1,1));
f.set("mobius_im_d",random(-1,1));
f.set("bcollide_num",random(1.1,8.1));
f.set("bcollide_a",random(-0.5,1));
f.set("bmod_radius", random(0.01, TWO_PI));
f.set("bmod_distance", random(0.01, 2));
f.set("bswirl_in", random(-2,2));
f.set("bswirl_out", random(-2,2));
f.set("btransform_rotate", random(-TWO_PI, TWO_PI));
f.set("btransform_power", random(1,6));
f.set("btransform_move", random(-0.5,0.5));
f.set("btransform_split", random(-1,1));
f.set("bwraps7_cellsize", random(0.4,2));
f.set("bwraps7_space", random(0,0.8));
f.set("bwraps7_gain",random(0.5,2.5));
f.set("bwraps7_inner_twist", random(-PI,PI));
f.set("bwraps7_outer_twist", random(-PI,PI));
f.set("barycentroid_a",random(-1,1));
f.set("barycentroid_b",random(-1,1));
f.set("barycentroid_c",random(-1,1));
f.set("barycentroid_d",random(-1,1));
f.set("blocky_x", (random(0,1)<0.5?1.0:-1.0) * random(0.9,1));
f.set("blocky_y", (random(0,1)<0.5?1.0:-1.0) * random(0.9,1));
f.set("blocky_mp",(random(0,1)<0.5?1.0:-1.0) * random(1.5,6));
f.set("blocky_weight",random(0.4,1));
f.set("blurzoom_length",random(-1.0,1.5));
f.set("blurzoom_x", random(-1,1));
f.set("blurzoom_y", random(-1,1));
f.set("boarders2_c",random(0.1,0.9));
f.set("boarders2_left",random(0.1,0.9));
f.set("boarders2_right",random(0.1,0.9));
f.set("cannabiscurvewf_filled",random01());
f.set("checks_x", random(0.2,1.5));
f.set("checks_y", random(0.2,1.5));
f.set("checks_size", random(0.4,1.5));
f.set("checks_rnd", random(0,1)<0.5?0.0:1.0);
f.set("circlecrop_radius", random(1,2));
f.set("circlecrop_zero", random01());
f.set("circlecrop_scatterarea", random(-1,1));
f.set("circlecrop_x", random(-0.5,0.5));
f.set("circlecrop_y", random(-0.5,0.5));
f.set("circlize_hole",random(-2,2));
f.set("cloverleaf_filled",random01());
f.set("collideoscope_a", random(0,1));
f.set("collideoscope_num", (int)random(1,10));
f.set("crackle_cellsize", random(0.02,1.0));
f.set("crackle_power", random(0.001,2));
f.set("crackle_distort", random(-2,2));
f.set("crackle_scale",random(0.1,10));
f.set("crackle_z",random(-15,15));
f.set("crop_left",random(-2.0,-0.5));
f.set("crop_right",random(0.5,2.0));
f.set("crop_top",random(-2.0,-0.5));
f.set("crop_bottom",random(0.5,2.0));
f.set("crop_scatter_area",random(-2,2));
f.set("crop_zero",random01());
f.set("dcperlin_shape",(int)random(0,3)); // 0,1,2
f.set("dcperlin_map",(int)random(0,7)); // 0-5
f.set("dcperlin_select_centre", random(-1,1));
f.set("dcperlin_select_range", random(0.1,2.0));
f.set("dcperlin_edge", random(0.5,2.5));
f.set("dcperlin_scale", random(0.1,3.0));
f.set("dcperlin_octaves",(int)random(1,4));
f.set("dcperlin_freqs",random(0.25,0.75));
f.set("dcperlin_z",random(-10,10));
f.set("dcperlin_select_bailout",random(2,100));
f.set("dcperlin_centre", random(-0.3,0.3));
f.set("dcperlin_range", random(0.5,1.5));
f.set("dlawf_buffersize",random(500,1500));
f.set("dlawf_maxiter", random(3000,10000));
f.set("dlawf_seed", (1.0+millis()) * (1.0+frameCount) % random(1000,1.0e20));
f.set("dlawf_scale", random(10,20));
f.set("ecollide_num", (int)random(1,10));
f.set("ecollide_a", random(-1,1));
f.set("ejulia_power",random(-6.6));
f.set("emod_radius",random(0.3,2));
f.set("emod_distance",random(-1,1));
f.set("emotion_move",random(-0.5,0.5));
f.set("emotion_rotate",random(-PI,PI));
f.set("epush_dist", random(0.5,1.2) * (random01() * 2.0 - 1.0));
f.set("epush_push", random(-1,1));
f.set("epush_rotate", random(-PI,PI));
f.set("erotate_rotate", random(0,TWO_PI));
f.set("escale_scale", random(0.6,1.5));
f.set("escale_angle", random(-PI,PI));
f.set("eswirl_in", random(-0.5,0.5));
f.set("eswirl_out", random(-1,1));
f.set("eclipse_shift", random(-2,2));
f.set("eclipse_weight", random(0.5,2));
f.set("epispiral_n",(int)random(2,15));
f.set("epispiral_thickness",random(-1,1));
f.set("epispiral_holes", random(-1,0));
f.set("epispiralwf_waves",(int)random(2,15));
f.set("fibonacci2_sc",random(-1,1));
f.set("fibonacci2_sc2",random(-1,1));
f.set("flipcircle_weight",random(0.4,1.5));
f.set("fourth_spin",random(0,TWO_PI));
f.set("fourth_space", random(-1,1));
f.set("fourth_twist", random(0,TWO_PI));
f.set("fourth_x", random(-0.5,0.5));
f.set("fourth_y", random(-0.5,0.5));
f.set("fourth_weight", random(0.4,1.0));
f.set("gdoffs_delta_x", random(8,12.0));
f.set("gdoffs_delta_y", random(8,12.0));
f.set("gdoffs_area_x", random(2.0,3.0));
f.set("gdoffs_area_y", random(2.0,3.0));
f.set("gdoffs_center_x", randomGaussian()/3);
f.set("gdoffs_center_y", randomGaussian()/3);
f.set("gdoffs_gamma", (int)random(1,7));
f.set("gdoffs_square", (int)random(0,2));
f.set("glynnsim1_radius", random(1.0,2.0));
f.set("glynnsim1_radius1", random(0.05,0.8));
f.set("glynnsim1_phi1", random(0,360));
f.set("glynnsim1_thickness", random(0,1));
f.set("glynnsim1_pow",random(-3,3));
f.set("glynnsim1_contrast",random(0,1));
f.set("glynnsim2_radius", random(0.5,2.0));
f.set("glynnsim2_phi1", random(0,360));
f.set("glynnsim2_phi2", random(0,360));
f.set("glynnsim2_thickness", random(0.01,1.0));
f.set("glynnsim2_pow",random(-3,3));
f.set("glynnsim2_contrast",random(0,1));
f.set("glynnsim3_radius", random(0.5,2.0));
f.set("glynnsim3_thickness", random(0.01,1.0));
f.set("glynnsim3_thickness2", random(0.01,1.0));
f.set("glynnsim3_pow",random(-3,3));
f.set("glynnsim3_contrast",random(0,1));
f.set("heartwf_scale_x",random(0.7,1.3));
f.set("heartwf_shift_t",random(-0.5,0.5));
f.set("heartwf_scale_t_left", random(0.7,1.3));
f.set("heartwf_scale_t_right", random(0.7,1.3));
f.set("hexes_cellsize", random(0.5,2.0));
f.set("hexes_power", random(0.3,6.0));
f.set("hexes_rotate", random(0, TWO_PI));
f.set("hexes_scale",random(0.5,2.0));
f.set("hypertile1_p",random(3,8));
f.set("hypertile1_q",random(3,8));
f.set("hypertile2_p",random(3,8));
f.set("hypertile2_q",random(3,8));
f.set("hypertile_p",random(3,8));
f.set("hypertile_q",random(3,8));
f.set("hypertile_n",random(0,8));
f.set("jaccn_k",random(-1.0,1.0));
f.set("jacdn_k",random(-1.0,1.0));
f.set("jacsn_k",random(-1.0,1.0));
f.set("juliac_re",(random(1)<0.5?1:-1) * ((int)(random(4.0,24.0)) * 0.25 ));
f.set("juliac_im", random(-3,3));
f.set("juliac_dist", random(-2,2));
f.set("asteria_alpha",random(0,2));
f.set("bwrands_cellsize",random(0.5,2.0));
f.set("bwrands_space",random(0,1));
f.set("bwrands_gain",random(0.8,2.0));
f.set("bwrands_inner_twist",random(0,TWO_PI));
f.set("bwrands_outer_twist",random(0,TWO_PI));
f.set("bwrands_seed",(int)random(0,MAX_INT));
f.set("bwrands_rrot",random(0,1));
f.set("bwrands_rmin",random(0,1));
f.set("bwrands_loonie_chance",random(0,1));
f.set("bwrands_petals_chance",random(0,1));
f.set("bwrands_minpetals",(int)random(1,20));
f.set("bwrands_maxpetals", f.get("bwrands_minpetals")+(int)random(1,20));
f.set("circlize2_hole",random(-2,2));
f.set("funnel_effect",random(0,8));
f.set("funnel2_effect",random(0,8));
f.set("juliaq_power", ((random(1)<0.5?-1.0:1.0)*random(1.5,10)));
f.set("juliaq_divisor", random(1,5));
f.set("kaleidoscope_pull",random(-1,1));
f.set("kaleidoscope_rotate",random(-PI,PI));
f.set("kaleidoscope_lineup",random(-1,1));
f.set("kaleidoscope_x",random(-1,1));
f.set("kaleidoscope_y",random(-1,1));
f.set("layeredspiral_radius",((random(1)<0.5?-1.0:1.0)*random(0.9,1.3)));
f.set("vibration2_dir",random(0, TWO_PI));
f.set("vibration2_angle",random(0,TWO_PI));
f.set("vibration2_freq",random(-1.1,1.1));
f.set("vibration2_amp",random(-1,1));
f.set("vibration2_phase",random(-1,1));
f.set("vibration2_dir2",random(0,TWO_PI));
f.set("vibration2_angle2",random(0,TWO_PI));
f.set("vibration2_freq2",random(-1.1,1.1));
f.set("vibration2_amp2",random(-1,1));
f.set("vibration2_phase2",random(-1,1));
f.set("vibration2_dm",random(-1,1));
f.set("vibration2_dmfreq",random(-1,1));
f.set("vibration2_tm",random(-1,1));
f.set("vibration2_tmfreq",random(-1,1));
f.set("vibration2_fm",random(-1,1));
f.set("vibration2_fmfreq",random(-1,1));
f.set("vibration2_am",random(-1,1));
f.set("vibration2_amfreq",random(-1,1));
f.set("vibration2_d2m",random(-1,1));
f.set("vibration2_d2mfreq",random(-1,1));
f.set("vibration2_t2m",random(-1,1));
f.set("vibration2_t2mfreq",random(-1,1));
f.set("vibration2_f2m",random(-1,1));
f.set("vibration2_f2mfreq",random(-1,1));
f.set("vibration2_a2m",random(-1,1));
f.set("vibration2_a2mfreq",random(-1,1));
f.set("lazyjess_n",(int)random(2,10));
f.set("lazyjess_spin",random(-PI,PI));
f.set("lazyjess_space", random(-0.5,0.5));
f.set("lazyjess_corner",(int)random(1,10));
f.set("lazyjess_weight",random(0.8,1.2));
f.set("lineart_powx",random(0.5,1.5));
f.set("lineart_powy",random(0.5,1.5));
f.set("lissajous_tmin",random(-TWO_PI,0));
f.set("lissajous_tmax",random(0,TWO_PI)+f.get("lissajous_tmin"));
f.set("lissajous_a",random(-5,5));
f.set("lissajous_b",random(-5,5));
f.set("lissajous_c",random(-1,1));
f.set("lissajous_d",random(-5,5));
f.set("lissajous_e",random(-2,2));
f.set("logapo_base",random(0.5,5));
f.set("logdb_base",random(0.5,5));
f.set("logdb_fix_period",random(0.3,3));
f.set("loonie2_sides",(int)random(1,30));
f.set("loonie2_star",random(-1,1));
f.set("loonie2_circle",random(-1,1));
f.set("loonie2_weight",random(0.8,1.6));
f.set("loonie3_weight",random(0.8,1.6));
f.set("mcarpet_x",random(-1,1));
f.set("mcarpet_y",random(-1,1));
f.set("mcarpet_tilt",random(-1,1));
f.set("mcarpet_twist",random(-1,1));
f.set("murl2_power",random(-3,3));
f.set("murl2_c",random(-1,1));
f.set("murl_power",random(-3,3));
f.set("murl_c",random(-1,1));
f.set("nblur_numedges",(int)random(3,20));
f.set("nblur_numstripes",random(1)<0.5?0:(int)random(-30,30));
// f.set("nblur_numstripes",0);
f.set("nblur_ratiostripes",random(0,2));
f.set("nblur_ratiohole",random(0,1));
f.set("nblur_circumcircle",random(0,1)<0.5?1:0);
f.set("nblur_adjusttolinear",random(0,1)<0.5?1:0);
f.set("nblur_equalblur",random(0,1)<0.5?1:0);
f.set("nblur_exactcalc",random(0,1)<0.5?1:0);
f.set("nblur_highlightedges",random(0,2));
f.set("nblur_weight",random(0.8,1.25));
f.set("bsplit_shiftx",random(-2.0,2.0));
f.set("bsplit_shifty",random(-2.0,2.0));
f.set("devilwarp_a",random(-3,3));
f.set("devilwarp_b",random(-3,3));
f.set("devilwarp_effect",random(-2,2));
f.set("devilwarp_warp",random(0.5,3));
f.set("devilwarp_rmin",random(1));
f.set("devilwarp_rmax",random(f.get("devilwarp_rmin")+random(0.5,1)));
f.set("oscilloscope2_separation",random(0.01,2));
f.set("oscilloscope2_frequencyx",random(-8,8));
f.set("oscilloscope2_frequencyy",random(-8,8));
f.set("oscilloscope2_amplitude",random(0.4,3));
f.set("oscilloscope2_damping",random(0,1));
f.set("oscilloscope2_perturbation",random(1));
return f;
}
class Folds {
int screenl, screenr;
int middle;
float ymin;
float ymax;
float xmin;
float xmax;
FloatDict params;
String[] foldnames = { "none",
"lines","flower","spherical","horseshoe","polar","spiral","hyperbolic","diamond","ex","julia","handkerchief",
"disc","exponential","swirl","heart","power","eyefish","fisheye","bubble","square","cylinder","waves",
"popcorn","sinusoidal","butterfly","cosine","rings","fan","blob","pdj","bent","fan2","rings2","perspective","vnoise",
"julian","juliascope","blur","gaussian","realgaussian","radialblur","pie","ngon","curl","wedgejulia","circus","rectangles",
"arch","tangent","rays","blade","secant","twintrian","cross","disc2","supershape","conic","parabola","bent2",
"boarders","bipolar","cell","fold","foci","loonie","polar2","scry","vexp","rotate","curve","edisc", "elliptic",
"escher", "lazysuzan", "modulus", "oscilloscope", "popcorn2", "separation", "split", "splits", "stripes", "wedge", "wedgesph",
"whorl", "waves2", "auger", "flux", "mobius", "vlog", "vsin", "vcos", "vtan", "sec", "csc", "cot", "vsinh", "vcosh", "vtanh", "sech", "csch", "coth",
"bcollide", "bmod", "bswirl", "btransform", "bwraps7", "barycentroid", "bilinear", "blocky", "blurzoom", "boarders2", "cannabiscurvewf",
"checks", "circleblur", "circlecrop", "circlize", "cloverleaf", "collideoscope", "crackle", "crop", "dcperlin", "dlawf",
"ecollide", "ejulia", /* brakowalo emod... do glynnsim3*/ "emod", "emotion", "epush", "erotate", "escale", "eswirl", "eclipse", "epispiral", "epispiralwf", "fibonacci2", "flipcircle",
"flipy", "fourth", "gdoffs", "glynnsim1", "glynnsim2", "glynnsim3", "glynnia", "heartwf", "hexes", "hypertile1", "hypertile2", "hypertile",
"jaccn", "jacdn", "jacsn", "juliac", "asteria", "bwrands", "circlize2", "ennepers", "funnel", "funnel2", "juliaq", "kaleidoscope","layeredspiral", "vibration2", "lazyjess",
"lineart","lissajous","logapo","logdb","loonie2", "loonie3", "mcarpet","murl2","murl","nblur", "bsplit", "devilwarp", "oscilloscope2"};
float lines_scale, lines_squared;
float flower_petals, flower_holes;
float waves_b, waves_e, waves_c, waves_f;
float popcorn_c,popcorn_f;
float rings_c, rings_c2;
float fan_c, fan_f, fan_cc, fan_c2;
float blob_low, blob_high, blob_waves, blob_bdiff;
float pdj_a, pdj_b, pdj_c, pdj_d;
float fan2_x, fan2_y, fan2_dx, fan2_dx2;
float rings2_val, rings2_val2;
float perspective_angle, perspective_dist, perspective_vsin, perspective_vfcos;
float julian_power, julian_dist, julian_cpower, julian_abspower;
float juliascope_power, juliascope_dist, juliascope_cpower, juliascope_abspower;
float radialblur_angle, radialblur_spinvar, radialblur_zoomvar;
float pie_slices, pie_rotation, pie_thickness;
float ngon_sides, ngon_power, ngon_circle, ngon_corners, ngon_pow, ngon_b;
float curl_c1, curl_c2;
float wedgejulia_count, wedgejulia_angle, wedgejulia_power, wedgejulia_dist, wedgejulia_cf, wedgejulia_cn, wedgejulia_rN;
float circus_size;
float rectangles_x, rectangles_y;
float arch_weight;
float rays_weight;
float blade_weight;
float secant_weight;
float twintrian_weight;
float disc2_rot, disc2_twist, disc2_timespi, disc2_sinadd, disc2_cosadd;
float supershape_rnd, supershape_m, supershape_n1, supershape_n2, supershape_n3, supershape_holes, supershape_pm_4, supershape_pneg1_n1;
float conic_holes;
float conic_eccentricity;
float parabola_width, parabola_height;
float bent2_x, bent2_y;
float bipolar_shift, bipolar_ps;
float cell_size;
float cpow_r, cpow_i, cpow_power, cpow_va, cpow_vc, cpow_vd;
float loonie_weight;
float scry_weight;
float curve_xamp, curve_yamp, curve_xlength, curve_ylength, curve_xlength2, curve_ylength2;
float elliptic_v;
float escher_beta, escher_vc, escher_vd;
float lazysuzan_twist, lazysuzan_space, lazysuzan_spin, lazysuzan_x, lazysuzan_y, lazysuzan_weight;
float modulus_x, modulus_y;
float oscilloscope_separation, oscilloscope_frequency, oscilloscope_amplitude, oscilloscope_damping;
float popcorn2_x, popcorn2_y, popcorn2_c;
float separation_x, separation_y, separation_xinside, separation_yinside, separation_x2, separation_y2;
float split_xsize, split_ysize;
float splits_x, splits_y;
float stripes_space, stripes_warp;
float wedge_angle, wedge_hole, wedge_count, wedge_swirl;
float wedgesph_angle, wedgesph_hole, wedgesph_count, wedgesph_swirl;
float whorl_inside, whorl_outside, whorl_weight;
float waves2_freqx, waves2_freqy, waves2_scalex, waves2_scaley;
float auger_freq, auger_scale, auger_sym, auger_weight;
float flux_spread, flux_weight;
float mobius_re_a, mobius_im_a, mobius_re_b, mobius_im_b, mobius_re_c, mobius_im_c, mobius_re_d, mobius_im_d;
float bcollide_num, bcollide_a, bcollide_bcn_pi, bcollide_pi_bcn, bcollide_bca_bcn;
float bmod_radius, bmod_distance;
float bswirl_in, bswirl_out;
float btransform_rotate, btransform_power, btransform_move, btransform_split;
float bwraps7_cellsize, bwraps7_space, bwraps7_gain, bwraps7_inner_twist, bwraps7_outer_twist, bwraps7_g2, bwraps7_r2, bwraps7_rfactor;
float barycentroid_a, barycentroid_b, barycentroid_c, barycentroid_d, barycentroid_dot00, barycentroid_dot01, barycentroid_dot11, barycentroid_invdenom;
float blocky_x, blocky_y, blocky_mp, blocky_weight;
float blurzoom_x, blurzoom_y, blurzoom_length;
float boarders2_c, boarders2_left, boarders2_right, boarders2_cl, boarders2_cr;
float cannabiscurvewf_filled;
float checks_x, checks_y, checks_size, checks_rnd, checks_cs;
float circlecrop_x, circlecrop_y, circlecrop_scatterarea, circlecrop_zero, circlecrop_radius;
float circlize_hole;
float cloverleaf_filled;
float collideoscope_a, collideoscope_num, collideoscope_kn_pi, collideoscope_pi_kn, collideoscope_ka_kn;
float crackle_cellsize, crackle_power, crackle_distort, crackle_scale, crackle_z;
Crackle crackle_obj;
float crop_left, crop_right, crop_top, crop_bottom, crop_scatter_area, crop_zero, crop_w, crop_h;
float dcperlin_centre, dcperlin_range, dcperlin_notch_bottom, dcperlin_notch_top, dcperlin_shape, dcperlin_map, dcperlin_select_centre, dcperlin_select_range, dcperlin_edge, dcperlin_scale, dcperlin_octaves, dcperlin_freqs, dcperlin_z, dcperlin_select_bailout;
float dlawf_buffersize, dlawf_maxiter, dlawf_seed, dlawf_scale;
DLAWF dlawf_obj;
float ecollide_num, ecollide_a, ecollide_ecn_pi, ecollide_pi_ecn, ecollide_eca_ecn;
float ejulia_power;
float emod_radius, emod_distance;
float emotion_move, emotion_rotate;
float epush_dist, epush_push, epush_rotate;
float erotate_rotate;
float escale_scale, escale_angle;
float eswirl_in, eswirl_out;
float eclipse_shift, eclipse_weight;
float epispiral_n, epispiral_thickness, epispiral_holes;
float epispiralwf_waves;
float fibonacci2_sc, fibonacci2_sc2;
float flipcircle_weight;
float fourth_spin, fourth_space, fourth_twist, fourth_x, fourth_y, fourth_weight, fourth_sqrvvar;
float gdoffs_delta_x, gdoffs_delta_y, gdoffs_area_x, gdoffs_area_y, gdoffs_center_x, gdoffs_center_y, gdoffs_gamma, gdoffs_square, gdoffs_gdodx, gdoffs_gdody, gdoffs_gdoax, gdoffs_gdoay, gdoffs_gdocx, gdoffs_gdocy, gdoffs_gdob;
float glynnsim1_radius, glynnsim1_radius1, glynnsim1_phi1, glynnsim1_thickness, glynnsim1_pow, glynnsim1_contrast, glynnsim1_x1, glynnsim1_y1, glynnsim1_abspow;
float glynnsim2_radius, glynnsim2_phi1, glynnsim2_phi2, glynnsim2_thickness, glynnsim2_pow, glynnsim2_contrast, glynnsim2_phi10, glynnsim2_phi20, glynnsim2_abspow, glynnsim2_gamma, glynnsim2_delta;
float glynnsim3_radius, glynnsim3_thickness2, glynnsim3_thickness, glynnsim3_pow, glynnsim3_contrast, glynnsim3_abspow, glynnsim3_gamma, glynnsim3_radius1, glynnsim3_radius2;
float heartwf_scale_x,heartwf_shift_t, heartwf_scale_t_left, heartwf_scale_t_right;
Hexes hexes_obj;
float hexes_cellsize, hexes_power, hexes_rotate, hexes_scale;
float hypertile1_pa, hypertile1_r, hypertile1_q, hypertile1_p;
float hypertile2_pa, hypertile2_r, hypertile2_q, hypertile2_p;
float hypertile_re, hypertile_im, hypertile_q, hypertile_p, hypertile_n;
float jaccn_k;
float jacdn_k;
float jacsn_k;
float juliac_re, juliac_im, juliac_dist;
float asteria_alpha, asteria_sina, asteria_cosa;
float bwrands_cellsize, bwrands_space, bwrands_gain, bwrands_inner_twist, bwrands_outer_twist, bwrands_seed, bwrands_rrot, bwrands_rmin, bwrands_loonie_chance, bwrands_petals_chance, bwrands_minpetals, bwrands_maxpetals, bwrands_petx, bwrands_pety, bwrands_g2, bwrands_r2, bwrands_rfactor;
float circlize2_hole;
float funnel_effect;
float funnel2_effect;
float juliaq_power, juliaq_divisor, juliaq_half_inv_power, juliaq_inv_power, juliaq_inv_power_2pi;
float kaleidoscope_pull, kaleidoscope_rotate, kaleidoscope_lineup, kaleidoscope_x, kaleidoscope_y;
float layeredspiral_radius;
float vibration2_dir,vibration2_angle,vibration2_freq,vibration2_amp,vibration2_phase,vibration2_dir2,vibration2_angle2,vibration2_freq2,vibration2_amp2,vibration2_phase2,vibration2_dm,vibration2_dmfreq,vibration2_tm,vibration2_tmfreq,vibration2_fm,vibration2_fmfreq,vibration2_am,vibration2_amfreq,vibration2_d2m,vibration2_d2mfreq,vibration2_t2m,vibration2_t2mfreq,vibration2_f2m,vibration2_f2mfreq,vibration2_a2m,vibration2_a2mfreq;
float lazyjess_n, lazyjess_spin, lazyjess_space, lazyjess_corner, lazyjess_vertex, lazyjess_sin_vertex, lazyjess_pie_slice, lazyjess_half_slice, lazyjess_corner_rotation, lazyjess_weight;
float lineart_powx, lineart_powy;
float lissajous_tmin, lissajous_tmax, lissajous_a, lissajous_b, lissajous_c, lissajous_d, lissajous_e;
float logapo_base, logapo_denom;
float logdb_base, logdb_fix_period, logdb_denom, logdb_fixpe;
float loonie2_sides, loonie2_star, loonie2_circle, loonie2_weight, loonie2_sqrvvar, loonie2_sina, loonie2_cosa, loonie2_sins, loonie2_coss, loonie2_sinc, loonie2_cosc;
float loonie3_weight, loonie3_sqrvvar;
float mcarpet_x, mcarpet_y, mcarpet_twist, mcarpet_tilt;
float murl2_power, murl2_c;
float murl_power, murl_c;
float nblur_numedges, nblur_numstripes, nblur_ratiostripes, nblur_ratiohole, nblur_circumcircle, nblur_adjusttolinear, nblur_equalblur, nblur_exactcalc, nblur_highlightedges;
float nblur_weight, nblur_midAngle, nblur_angStripes, nblur_angStart, nblur_ratiocomplement, nblur_tan90_m_2, nblur_sina, nblur_cosa, nblur_speedCalc1, nblur_speedCalc2, nblur_maxStripes, nblur_arc_tan1, nblur_arc_tan2;
int nblur_hasStripes, nblur_negStripes;
float bsplit_shiftx, bsplit_shifty;
float devilwarp_a, devilwarp_b, devilwarp_effect, devilwarp_warp, devilwarp_rmin, devilwarp_rmax;
float oscilloscope2_separation, oscilloscope2_frequencyx, oscilloscope2_frequencyy, oscilloscope2_amplitude, oscilloscope2_damping, oscilloscope2_perturbation;
Folds() {
float middle = width/2;
float size = 0.95 * middle;
screenl = (int)(-size + middle);
screenr =(int)(size + middle);
ymin = -3.5;
ymax = 3.5;
xmin = -3.5;
xmax = 3.5;
setParameters(getFoldsParameters());
}
Folds(int _size,float _ymin,float _ymax,float _xmin,float _xmax) {
float middle = _size/2;
float size = 0.95 * middle;
screenl = (int)(-size + middle);
screenr =(int)(size + middle);
ymin = _ymin;
ymax = _ymax;
xmin = _xmin;
xmax = _xmax;
setParameters(getFoldsParameters());
}
void setParameters(FloatDict p) {
params = p;
lines_scale = p.get("lines_scale");
lines_squared = p.get("lines_squared");
flower_petals = p.get("flower_petals");
flower_holes = p.get("flower_holes");
waves_b = p.get("waves_b");
waves_e = p.get("waves_e");
waves_c = p.get("waves_c");
waves_f = p.get("waves_f");
popcorn_c = p.get("popcorn_c");
popcorn_f = p.get("popcorn_f");
rings_c = p.get("rings_c");
fan_c = p.get("fan_c");
fan_f = p.get("fan_f");
blob_low = p.get("blob_low");
blob_high = p.get("blob_high");
blob_waves = p.get("blob_waves");
pdj_a = p.get("pdj_a");
pdj_b = p.get("pdj_b");
pdj_c = p.get("pdj_c");
pdj_d = p.get("pdj_d");
fan2_x = p.get("fan2_x");
fan2_y = p.get("fan2_y");
rings2_val = p.get("rings2_val");
perspective_angle = p.get("perspective_angle");
perspective_dist = p.get("perspective_dist");
julian_power = p.get("julian_power");
julian_dist = p.get("julian_dist");
juliascope_power = p.get("juliascope_power");
juliascope_dist = p.get("juliascope_dist");
radialblur_angle = p.get("radialblur_angle");
pie_slices = p.get("pie_slices");
pie_rotation = p.get("pie_rotation");
pie_thickness = p.get("pie_thickness");
ngon_sides = p.get("ngon_sides");
ngon_power = p.get("ngon_power");
ngon_circle = p.get("ngon_circle");
ngon_corners = p.get("ngon_corners");
curl_c1 = p.get("curl_c1");
curl_c2 = p.get("curl_c2");
wedgejulia_count = p.get("wedgejulia_count");
wedgejulia_angle = p.get("wedgejulia_angle");
wedgejulia_power = p.get("wedgejulia_power");
wedgejulia_dist = p.get("wedgejulia_dist");
circus_size = p.get("circus_size");
rectangles_x = p.get("rectangles_x");
rectangles_y = p.get("rectangles_y");
arch_weight = p.get("arch_weight");
rays_weight = p.get("rays_weight");
blade_weight = p.get("blade_weight");
secant_weight = p.get("secant_weight");
twintrian_weight = p.get("twintrian_weight");
disc2_rot = p.get("disc2_rot");
disc2_twist = p.get("disc2_twist");
supershape_rnd = p.get("supershape_rnd");
supershape_m = p.get("supershape_m");
supershape_n1 = p.get("supershape_n1");
supershape_n2 = p.get("supershape_n2");
supershape_n3 = p.get("supershape_n3");
supershape_holes = p.get("supershape_holes");
conic_holes = p.get("conic_holes");
conic_eccentricity = p.get("conic_eccentricity");
parabola_width = p.get("parabola_width");
parabola_height = p.get("parabola_height");
bent2_x = p.get("bent2_x");
bent2_y = p.get("bent2_y");
bipolar_shift = p.get("bipolar_shift");
cell_size = p.get("cell_size");
cpow_r = p.get("cpow_r");
cpow_i = p.get("cpow_i");
cpow_power = p.get("cpow_power");
loonie_weight = p.get("loonie_weight");
scry_weight = p.get("scry_weight");
curve_xamp = p.get("curve_xamp");
curve_yamp = p.get("curve_yamp");
curve_xlength = p.get("curve_xlength");
curve_ylength = p.get("curve_ylength");
escher_beta = p.get("escher_beta");
lazysuzan_spin = p.get("lazysuzan_spin");
lazysuzan_twist = p.get("lazysuzan_twist");
lazysuzan_space = p.get("lazysuzan_space");
lazysuzan_x = p.get("lazysuzan_x");
lazysuzan_y = p.get("lazysuzan_y");
lazysuzan_weight = p.get("lazysuzan_weight");
modulus_x = p.get("modulus_x");
modulus_y = p.get("modulus_y");
oscilloscope_separation = p.get("oscilloscope_separation");
oscilloscope_frequency = p.get("oscilloscope_frequency");
oscilloscope_amplitude = p.get("oscilloscope_amplitude");
oscilloscope_damping = p.get("oscilloscope_damping");
popcorn2_x = p.get("popcorn2_x");
popcorn2_y = p.get("popcorn2_y");
popcorn2_c = p.get("popcorn2_c");
separation_x = p.get("separation_x");
separation_y = p.get("separation_y");
separation_xinside = p.get("separation_xinside");
separation_yinside = p.get("separation_yinside");
split_xsize = p.get("split_xsize");
split_ysize = p.get("split_ysize");
splits_x = p.get("splits_x");
splits_y = p.get("splits_y");
stripes_space = p.get("stripes_space");
stripes_warp = p.get("stripes_warp");
wedge_angle = p.get("wedge_angle");
wedge_hole = p.get("wedge_hole");
wedge_count = p.get("wedge_count");
wedge_swirl = p.get("wedge_swirl");
wedgesph_angle = p.get("wedge_angle");
wedgesph_hole = p.get("wedge_hole");
wedgesph_count = p.get("wedge_count");
wedgesph_swirl = p.get("wedge_swirl");
whorl_inside = p.get("whorl_inside");
whorl_outside = p.get("whorl_outside");
whorl_weight = p.get("whorl_weight");
waves2_freqx = p.get("waves2_freqx");
waves2_freqy = p.get("waves2_freqy");
waves2_scalex = p.get("waves2_scalex");
waves2_scaley = p.get("waves2_scaley");
auger_freq = p.get("auger_freq");
auger_scale = p.get("auger_scale");
auger_sym = p.get("auger_sym");
auger_weight = p.get("auger_weight");
flux_spread = p.get("flux_spread");
flux_weight = p.get("flux_weight");
mobius_re_a = p.get("mobius_re_a");
mobius_im_a = p.get("mobius_im_a");
mobius_re_b = p.get("mobius_re_b");
mobius_im_b = p.get("mobius_im_b");
mobius_re_c = p.get("mobius_re_c");
mobius_im_c = p.get("mobius_im_c");
mobius_re_d = p.get("mobius_re_d");
mobius_im_d = p.get("mobius_im_d");
bcollide_num = p.get("bcollide_num");
bcollide_a = p.get("bcollide_a");
bmod_radius = p.get("bmod_radius");
bmod_distance = p.get("bmod_distance");
bswirl_in = p.get("bswirl_in");
bswirl_out = p.get("bswirl_out");
btransform_rotate = p.get("btransform_rotate");
btransform_power = p.get("btransform_power");
btransform_move = p.get("btransform_move");
btransform_split = p.get("btransform_split");
bwraps7_cellsize = p.get("bwraps7_cellsize");
bwraps7_space = p.get("bwraps7_space");
bwraps7_gain = p.get("bwraps7_gain");
bwraps7_inner_twist = p.get("bwraps7_inner_twist");
bwraps7_outer_twist = p.get("bwraps7_outer_twist");
barycentroid_a = p.get("barycentroid_a");
barycentroid_b = p.get("barycentroid_b");
barycentroid_c = p.get("barycentroid_c");
barycentroid_d = p.get("barycentroid_d");
blocky_x = p.get("blocky_x");
blocky_y = p.get("blocky_y");
blocky_mp = p.get("blocky_mp");
blocky_weight = p.get("blocky_weight");
blurzoom_x = p.get("blurzoom_x");
blurzoom_y = p.get("blurzoom_y");
blurzoom_length = p.get("blurzoom_length");
boarders2_c = p.get("boarders2_c");
boarders2_left = p.get("boarders2_left");
boarders2_right = p.get("boarders2_right");
cannabiscurvewf_filled = p.get("cannabiscurvewf_filled");
checks_x = p.get("checks_x");
checks_y = p.get("checks_y");
checks_size = p.get("checks_size");
checks_rnd = p.get("checks_rnd");
circlecrop_x = p.get("circlecrop_x");
circlecrop_y = p.get("circlecrop_y");
circlecrop_scatterarea = p.get("circlecrop_scatterarea");
circlecrop_zero = p.get("circlecrop_zero");
circlecrop_radius = p.get("circlecrop_radius");
circlize_hole = p.get("circlize_hole");
cloverleaf_filled = p.get("cloverleaf_filled");
collideoscope_a = p.get("collideoscope_a");
collideoscope_num = p.get("collideoscope_num");
crackle_cellsize = p.get("crackle_cellsize");
crackle_distort = p.get("crackle_distort");
crackle_power = p.get("crackle_power");
crackle_scale = p.get("crackle_scale");
crackle_z = p.get("crackle_z");
crop_left = p.get("crop_left");
crop_bottom = p.get("crop_bottom");
crop_right = p.get("crop_right");
crop_top = p.get("crop_top");
crop_scatter_area = p.get("crop_scatter_area");
crop_zero = p.get("crop_zero");
dcperlin_edge = p.get("dcperlin_edge");
dcperlin_freqs = p.get("dcperlin_freqs");
dcperlin_map = p.get("dcperlin_map");
dcperlin_octaves = p.get("dcperlin_octaves");
dcperlin_scale = p.get("dcperlin_scale");
dcperlin_select_bailout = p.get("dcperlin_select_bailout");
dcperlin_select_centre = p.get("dcperlin_select_centre");
dcperlin_select_range = p.get("dcperlin_select_range");
dcperlin_shape = p.get("dcperlin_shape");
dcperlin_z = p.get("dcperlin_z");
dcperlin_centre = p.get("dcperlin_centre");
dcperlin_range = p.get("dcperlin_range");
dlawf_buffersize = p.get("dlawf_buffersize");
dlawf_maxiter = p.get("dlawf_maxiter");
dlawf_seed = p.get("dlawf_seed");
dlawf_scale = p.get("dlawf_scale");
ecollide_a = p.get("ecollide_a");
ecollide_num = p.get("ecollide_num");
ejulia_power = p.get("ejulia_power");
emod_distance = p.get("emod_distance");
emod_radius = p.get("emod_radius");
emotion_move = p.get("emotion_move");
emotion_rotate = p.get("emotion_rotate");
epush_dist = p.get("epush_dist");
epush_push = p.get("epush_push");
epush_rotate = p.get("epush_rotate");
erotate_rotate = p.get("erotate_rotate");
escale_angle = p.get("escale_angle");
escale_scale = p.get("escale_scale");
eswirl_in = p.get("eswirl_in");
eswirl_out = p.get("eswirl_out");
eclipse_shift = p.get("eclipse_shift");
eclipse_weight = p.get("eclipse_weight");
epispiral_n = p.get("epispiral_n");
epispiral_holes = p.get("epispiral_holes");
epispiral_thickness = p.get("epispiral_thickness");
epispiralwf_waves = p.get("epispiralwf_waves");
fibonacci2_sc = p.get("fibonacci2_sc");
fibonacci2_sc2 = p.get("fibonacci2_sc2");
flipcircle_weight = p.get("flipcircle_weight");
fourth_spin = p.get("fourth_spin");
fourth_space = p.get("fourth_space");
fourth_twist = p.get("fourth_twist");
fourth_x = p.get("fourth_x");
fourth_y = p.get("fourth_y");
fourth_weight = p.get("fourth_weight");
gdoffs_delta_x = p.get("gdoffs_delta_x");
gdoffs_delta_y = p.get("gdoffs_delta_y");
gdoffs_area_x = p.get("gdoffs_area_x");
gdoffs_area_y = p.get("gdoffs_area_y");
gdoffs_center_x = p.get("gdoffs_center_x");
gdoffs_center_y = p.get("gdoffs_center_y");
gdoffs_gamma = p.get("gdoffs_gamma");
gdoffs_square = p.get("gdoffs_square");
glynnsim1_radius = p.get("glynnsim1_radius");
glynnsim1_radius1 = p.get("glynnsim1_radius1");
glynnsim1_phi1 = p.get("glynnsim1_phi1");
glynnsim1_thickness = p.get("glynnsim1_thickness");
glynnsim1_pow = p.get("glynnsim1_pow");
glynnsim1_contrast = p.get("glynnsim1_contrast");
glynnsim2_radius = p.get("glynnsim2_radius");
glynnsim2_phi2 = p.get("glynnsim2_phi2");
glynnsim2_phi1 = p.get("glynnsim2_phi1");
glynnsim2_thickness = p.get("glynnsim2_thickness");
glynnsim2_pow = p.get("glynnsim2_pow");
glynnsim2_contrast = p.get("glynnsim2_contrast");
glynnsim3_radius = p.get("glynnsim3_radius");
glynnsim3_thickness2 = p.get("glynnsim3_thickness2");
glynnsim3_thickness = p.get("glynnsim3_thickness");
glynnsim3_pow = p.get("glynnsim3_pow");
glynnsim3_contrast = p.get("glynnsim3_contrast");
heartwf_scale_t_left = p.get("heartwf_scale_t_left");
heartwf_scale_t_right = p.get("heartwf_scale_t_right");
heartwf_scale_x = p.get("heartwf_scale_x");
heartwf_shift_t = p.get("heartwf_shift_t");
hexes_cellsize = p.get("hexes_cellsize");
hexes_power = p.get("hexes_power");
hexes_rotate = p.get("hexes_rotate");
hexes_scale = p.get("hexes_scale");
hypertile1_p = p.get("hypertile1_p");
hypertile1_q = p.get("hypertile1_q");
hypertile2_p = p.get("hypertile2_p");
hypertile2_q = p.get("hypertile2_q");
hypertile_q = p.get("hypertile_q");
hypertile_p = p.get("hypertile_p");
hypertile_n = p.get("hypertile_n");
jaccn_k = p.get("jaccn_k");
jacdn_k = p.get("jacdn_k");
jacsn_k = p.get("jacsn_k");
juliac_dist = p.get("juliac_dist");
juliac_im = p.get("juliac_im");
juliac_re = p.get("juliac_re");
asteria_alpha = p.get("asteria_alpha");
bwrands_cellsize = p.get("bwrands_cellsize");
bwrands_space = p.get("bwrands_space");
bwrands_gain = p.get("bwrands_gain");
bwrands_inner_twist = p.get("bwrands_inner_twist");
bwrands_outer_twist = p.get("bwrands_outer_twist");
bwrands_seed = p.get("bwrands_seed");
bwrands_rrot = p.get("bwrands_rrot");
bwrands_rmin = p.get("bwrands_rmin");
bwrands_loonie_chance = p.get("bwrands_loonie_chance");
bwrands_petals_chance = p.get("bwrands_petals_chance");
bwrands_minpetals = p.get("bwrands_minpetals");
bwrands_maxpetals = p.get("bwrands_maxpetals");
circlize2_hole = p.get("circlize2_hole");
funnel_effect = p.get("funnel_effect");
funnel2_effect = p.get("funnel2_effect");
juliaq_power = p.get("juliaq_power");
juliaq_divisor = p.get("juliaq_divisor");
kaleidoscope_pull = p.get("kaleidoscope_pull");
kaleidoscope_rotate = p.get("kaleidoscope_rotate");
kaleidoscope_lineup = p.get("kaleidoscope_lineup");
kaleidoscope_x = p.get("kaleidoscope_x");
kaleidoscope_y = p.get("kaleidoscope_y");
layeredspiral_radius = p.get("layeredspiral_radius");
vibration2_dir = p.get("vibration2_dir");
vibration2_angle = p.get("vibration2_angle");
vibration2_freq = p.get("vibration2_freq");
vibration2_amp = p.get("vibration2_amp");
vibration2_phase = p.get("vibration2_phase");
vibration2_dir2 = p.get("vibration2_dir2");
vibration2_angle2 = p.get("vibration2_angle2");
vibration2_freq2 = p.get("vibration2_freq2");
vibration2_amp2 = p.get("vibration2_amp2");
vibration2_phase2 = p.get("vibration2_phase2");
vibration2_dm = p.get("vibration2_dm");
vibration2_dmfreq = p.get("vibration2_dmfreq");
vibration2_tm = p.get("vibration2_tm");
vibration2_tmfreq = p.get("vibration2_tmfreq");
vibration2_fm = p.get("vibration2_fm");
vibration2_fmfreq = p.get("vibration2_fmfreq");
vibration2_am = p.get("vibration2_am");
vibration2_amfreq = p.get("vibration2_amfreq");
vibration2_d2m = p.get("vibration2_d2m");
vibration2_d2mfreq = p.get("vibration2_d2mfreq");
vibration2_t2m = p.get("vibration2_t2m");
vibration2_t2mfreq = p.get("vibration2_t2mfreq");
vibration2_f2m = p.get("vibration2_f2m");
vibration2_f2mfreq = p.get("vibration2_f2mfreq");
vibration2_a2m = p.get("vibration2_a2m");
vibration2_a2mfreq = p.get("vibration2_a2mfreq");
lazyjess_n = p.get("lazyjess_n");
lazyjess_spin = p.get("lazyjess_spin");
lazyjess_space = p.get("lazyjess_space");
lazyjess_corner = p.get("lazyjess_corner");
lazyjess_weight = p.get("lazyjess_weight");
lineart_powx = p.get("lineart_powx");
lineart_powy = p.get("lineart_powy");
lissajous_tmin = p.get("lissajous_tmin");
lissajous_tmax = p.get("lissajous_tmax");
lissajous_a = p.get("lissajous_a");
lissajous_b = p.get("lissajous_b");
lissajous_c = p.get("lissajous_c");
lissajous_d = p.get("lissajous_d");
lissajous_e = p.get("lissajous_e");
logapo_base = p.get("logapo_base");
logdb_base = p.get("logdb_base");
logdb_fix_period = p.get("logdb_fix_period");
loonie2_sides = p.get("loonie2_sides");
loonie2_star = p.get("loonie2_star");
loonie2_circle = p.get("loonie2_circle");
loonie2_weight = p.get("loonie2_weight");
loonie3_weight = p.get("loonie3_weight");
mcarpet_x = p.get("mcarpet_x");
mcarpet_y = p.get("mcarpet_y");
mcarpet_tilt = p.get("mcarpet_tilt");
mcarpet_twist = p.get("mcarpet_twist");
murl2_power = p.get("murl2_power");
murl2_c = p.get("murl2_c");
murl_power = p.get("murl_power");
murl_c = p.get("murl_c");
nblur_numedges = p.get("nblur_numedges");
nblur_numstripes = p.get("nblur_numstripes");
nblur_ratiostripes = p.get("nblur_ratiostripes");
nblur_ratiohole = p.get("nblur_ratiohole");
nblur_circumcircle = p.get("nblur_circumcircle");
nblur_adjusttolinear = p.get("nblur_adjusttolinear");
nblur_equalblur = p.get("nblur_equalblur");
nblur_exactcalc = p.get("nblur_exactcalc");
nblur_highlightedges = p.get("nblur_highlightedges");
nblur_weight = p.get("nblur_weight");
bsplit_shiftx = p.get("bsplit_shiftx");
bsplit_shifty = p.get("bsplit_shifty");
devilwarp_a = p.get("devilwarp_a");
devilwarp_b = p.get("devilwarp_b");
devilwarp_effect = p.get("devilwarp_effect");
devilwarp_rmax = p.get("devilwarp_rmax");
devilwarp_rmin = p.get("devilwarp_rmin");
devilwarp_warp = p.get("devilwarp_warp");
oscilloscope2_separation = p.get("oscilloscope2_separation");
oscilloscope2_frequencyx = p.get("oscilloscope2_frequencyx");
oscilloscope2_frequencyy = p.get("oscilloscope2_frequencyy");
oscilloscope2_amplitude = p.get("oscilloscope2_amplitude");
oscilloscope2_damping = p.get("oscilloscope2_damping");
oscilloscope2_perturbation = p.get("oscilloscope2_perturbation");
precalc();
}
PVector getFoldbyNo(int no, PVector p, float w) {
switch(no) {
case 1: return lines(p,w);
case 2: return flower(p,w);
case 3: return spherical(p,w);
case 4: return horseshoe(p,w);
case 5: return polar(p,w);
case 6: return spiral(p,w);
case 7: return hyperbolic(p,w);
case 8: return diamond(p,w);
case 9: return ex(p,w);
case 10: return julia(p,w);
case 11: return handkerchief(p,w);
case 12: return disc(p,w);
case 13: return exponential(p,w);
case 14: return swirl(p,w);
case 15: return heart(p,w);
case 16: return power(p,w);
case 17: return eyefish(p,w);
case 18: return fisheye(p,w);
case 19: return bubble(p,w);
case 20: return square(p,w);
case 21: return cylinder(p,w);
case 22: return waves(p,w);
case 23: return popcorn(p,w);
case 24: return sinusoidal(p,w);
case 25: return butterfly(p,w);
case 26: return cosine(p,w);
case 27: return rings(p,w);
case 28: return fan(p,w);
case 29: return blob(p,w);
case 30: return pdj(p,w);
case 31: return bent(p,w);
case 32: return fan2(p,w);
case 33: return rings2(p,w);
case 34: return perspective(p,w);
case 35: return vnoise(p,w);
case 36: return julian(p,w);
case 37: return juliascope(p,w);
case 38: return blur(p,w);
case 39: return gaussian(p,w);
case 40: return realgaussian(p,w);
case 41: return radialblur(p,w);
case 42: return pie(p,w);
case 43: return ngon(p,w);
case 44: return curl(p,w);
case 45: return wedgejulia(p,w);
case 46: return circus(p,w);
case 47: return rectangles(p,w);
case 48: return arch(p,w);
case 49: return tangent(p,w);
case 50: return rays(p,w);
case 51: return blade(p,w);
case 52: return secant(p,w);
case 53: return twintrian(p,w);
case 54: return cross(p,w);
case 55: return disc2(p,w);
case 56: return supershape(p,w);
case 57: return conic(p,w);
case 58: return parabola(p,w);
case 59: return bent2(p,w);
case 60: return boarders(p,w);
case 61: return bipolar(p,w);
case 62: return cell(p,w);
case 63: return fold(p,w);
case 64: return foci(p,w);
case 65: return loonie(p,w);
case 66: return polar2(p,w);
case 67: return scry(p,w);
case 68: return vexp(p,w);
case 69: return rotate(p,w);
case 70: return curve(p,w);
case 71: return edisc(p,w);
case 72: return elliptic(p,w);
case 73: return escher(p,w);
case 74: return lazysuzan(p,w);
case 75: return modulus(p,w);
case 76: return oscilloscope(p,w);
case 77: return popcorn2(p,w);
case 78: return separation(p,w);
case 79: return split(p,w);
case 80: return splits(p,w);
case 81: return stripes(p,w);
case 82: return wedge(p,w);
case 83: return wedgesph(p,w);
case 84: return whorl(p,w);
case 85: return waves2(p,w);
case 86: return auger(p,w);
case 87: return flux(p,w);
case 88: return mobius(p,w);
case 89: return vlog(p,w);
case 90: return vsin(p,w);
case 91: return vcos(p,w);
case 92: return vtan(p,w);
case 93: return sec(p,w);
case 94: return csc(p,w);
case 95: return cot(p,w);
case 96: return vsinh(p,w);
case 97: return vcosh(p,w);
case 98: return vtanh(p,w);
case 99: return sech(p,w);
case 100: return csch(p,w);
case 101: return coth(p,w);
case 102: return bcollide(p,w);
case 103: return bmod(p,w);
case 104: return bswirl(p,w);
case 105: return btransform(p,w);
case 106: return bwraps7(p,w);
case 107: return barycentroid(p,w);
case 108: return bilinear(p,w);
case 109: return blocky(p,w);
case 110: return blurzoom(p,w);
case 111: return boarders2(p,w);
case 112: return cannabiscurvewf(p,w);
case 113: return checks(p,w);
case 114: return circleblur(p,w);
case 115: return circlecrop(p,w);
case 116: return circlize(p,w);
case 117: return cloverleaf(p,w);
case 118: return collideoscope(p,w);
case 119: return crackle(p,w);
case 120: return crop(p,w);
case 121: return dcperlin(p,w);
case 122: return dlawf(p,w);
case 123: return ecollide(p,w);
case 124: return ejulia(p,w);
case 125: return emod(p,w);
case 126: return emotion(p,w);
case 127: return epush(p,w);
case 128: return erotate(p,w);
case 129: return escale(p,w);
case 130: return eswirl(p,w);
case 131: return eclipse(p,w);
case 132: return epispiral(p,w);
case 133: return epispiralwf(p,w);
case 134: return fibonacci2(p,w);
case 135: return flipcircle(p,w);
case 136: return flipy(p,w);
case 137: return fourth(p,w);
case 138: return gdoffs(p,w);
case 139: return glynnsim1(p,w);
case 140: return glynnsim2(p,w);
case 141: return glynnsim3(p,w);
case 142: return glynnia(p,w);
case 143: return heartwf(p,w);
case 144: return hexes(p,w);
case 145: return hypertile1(p,w);
case 146: return hypertile2(p,w);
case 147: return hypertile(p,w);
case 148: return jaccn(p,w);
case 149: return jacdn(p,w);
case 150: return jacsn(p,w);
case 151: return juliac(p,w);
case 152: return asteria(p,w);
case 153: return bwrands(p,w);
case 154: return circlize2(p,w);
case 155: return ennepers(p,w);
case 156: return funnel(p,w);
case 157: return funnel2(p,w);
case 158: return juliaq(p,w);
case 159: return kaleidoscope(p,w);
case 160: return layeredspiral(p,w);
case 161: return vibration2(p,w);
case 162: return lazyjess(p,w);
case 163: return lineart(p,w);
case 164: return lissajous(p,w);
case 165: return logapo(p,w);
case 166: return logdb(p,w);
case 167: return loonie2(p,w);
case 168: return loonie3(p,w);
case 169: return mcarpet(p,w);
case 170: return murl2(p,w);
case 171: return murl(p,w);
case 172: return nblur(p,w);
case 173: return bsplit(p,w);
case 174: return devilwarp(p,w);
case 175: return oscilloscope2(p,w);
default: return new PVector(w * p.x, w * p.y);
}
}
void precalc() {
float tmp, tmp2;
rings_c2 = rings_c * rings_c;
fan_cc = PI * sq(fan_c);
fan_c2 = 0.5 * fan_cc;
blob_bdiff = blob_high - blob_low;
fan2_dx = PI * sq(fan2_x) + 1.0e-10;
fan2_dx2 = 0.5 * fan2_dx;
rings2_val2 = sq(rings2_val);
tmp = perspective_angle * PI/2.0;
perspective_vsin = sin(tmp);
perspective_vfcos = perspective_dist * cos(tmp);
julian_cpower = julian_dist/julian_power/2.0;
julian_abspower = abs(julian_power);
juliascope_cpower = juliascope_dist/juliascope_power/2.0;
juliascope_abspower = abs(juliascope_power);
radialblur_spinvar = sin(radialblur_angle);
radialblur_zoomvar = cos(radialblur_angle);
ngon_pow = ngon_power/2.0;
ngon_b = TWO_PI / ngon_sides;
wedgejulia_cf = 1.0 - 0.5 / PI * wedgejulia_angle * wedgejulia_count;
wedgejulia_cn = wedgejulia_dist / wedgejulia_power / 2.0;
wedgejulia_rN = abs(wedgejulia_power);
disc2_timespi = disc2_rot * PI;
disc2_sinadd = sin(disc2_twist);
disc2_cosadd = cos(disc2_twist)-1.0;
if(disc2_twist > TWO_PI) {
float k = 1 + disc2_twist - TWO_PI;
disc2_cosadd *= k;
disc2_sinadd *= k;
}
if(disc2_twist < -TWO_PI) {
float k = 1 + disc2_twist + TWO_PI;
disc2_cosadd *= k;
disc2_sinadd *= k;
}
supershape_pm_4 = supershape_m / 4.0;
supershape_pneg1_n1 = -1.0 / supershape_n1;
bipolar_ps = -HALF_PI * bipolar_shift;
cpow_va = TWO_PI / cpow_power;
cpow_vc = cpow_r / cpow_power;
cpow_vd = cpow_i / cpow_power;
curve_xlength2 = sq(curve_xlength);
curve_ylength2 = sq(curve_ylength);
elliptic_v = 2 / HALF_PI;
escher_vc = 0.5 * (1.0 + cos(escher_beta));
escher_vd = 0.5 * sin(escher_beta);
separation_x2 = sq(separation_x);
separation_y2 = sq(separation_y);
bcollide_bcn_pi = bcollide_num / PI;
bcollide_pi_bcn = PI / bcollide_num;
bcollide_bca_bcn = (PI * bcollide_a) / bcollide_num;
tmp = 0.5 * (bwraps7_cellsize / (1.0 + sq(bwraps7_space)));
bwraps7_g2 = sq(bwraps7_gain) + 1.0e-10;
tmp2 = bwraps7_g2 * tmp;
if(tmp2>2.0)
tmp2 = 1.0;
else
tmp2 *= 1.0 / (( sq(tmp2) / 4.0 + 1.0));
bwraps7_r2 = sq(tmp);
bwraps7_rfactor = tmp / tmp2;
barycentroid_dot00 = sq(barycentroid_a) + sq(barycentroid_b);
barycentroid_dot01 = barycentroid_a * barycentroid_c + barycentroid_b * barycentroid_d;
barycentroid_dot11 = sq(barycentroid_c) + sq(barycentroid_d);
barycentroid_invdenom = 1.0 / (barycentroid_dot00 * barycentroid_dot11 - sq(barycentroid_dot01));
boarders2_cl = boarders2_c * boarders2_left;
boarders2_cr = boarders2_c + (boarders2_c * boarders2_right);
checks_cs = 1.0 / (checks_size + 1.0e-10);
collideoscope_kn_pi = collideoscope_num / PI;
collideoscope_pi_kn = PI / collideoscope_num;
collideoscope_ka_kn = (PI * collideoscope_a) / collideoscope_num;
crackle_obj = new Crackle(crackle_z, crackle_cellsize, crackle_distort, crackle_power, crackle_scale);
crop_w = (crop_right - crop_left) * 0.5 * crop_scatter_area;
crop_h = (crop_bottom - crop_top) * 0.5 * crop_scatter_area;
dcperlin_notch_bottom = dcperlin_select_centre - dcperlin_select_range;
dcperlin_notch_bottom = (dcperlin_notch_bottom > 0.75) ? 0.75 : dcperlin_notch_bottom;
dcperlin_notch_bottom = (dcperlin_notch_bottom < -3.0) ? -3.0 : dcperlin_notch_bottom;
dcperlin_notch_top = dcperlin_select_centre + dcperlin_select_range;
dcperlin_notch_top = (dcperlin_notch_top < -0.75) ? -0.75 : dcperlin_notch_top;
dcperlin_notch_top = (dcperlin_notch_top > 3.0) ? 3.0 : dcperlin_notch_top;
dlawf_obj = new DLAWF(dlawf_seed, dlawf_maxiter, dlawf_buffersize, dlawf_scale);
ecollide_ecn_pi = ecollide_num / PI;
ecollide_pi_ecn = PI / ecollide_num;
ecollide_eca_ecn = (PI * ecollide_a) / ecollide_num;
fourth_sqrvvar = sq(fourth_weight);
gdoffs_gdodx = gdoffs_delta_x * gdoffs_agdod;
gdoffs_gdody = gdoffs_delta_y * gdoffs_agdod;
gdoffs_gdoax = (abs(gdoffs_area_x) < 0.1 ? 0.1 : abs(gdoffs_area_x)) * gdoffs_agdoa;
gdoffs_gdoay = (abs(gdoffs_area_y) < 0.1 ? 0.1 : abs(gdoffs_area_y)) * gdoffs_agdoa;
gdoffs_gdocx = gdoffs_center_x * gdoffs_agdoc;
gdoffs_gdocy = gdoffs_center_y * gdoffs_agdoc;
gdoffs_gdob = gdoffs_gamma * gdoffs_agdoa / (max(gdoffs_gdoax, gdoffs_gdoay));
tmp = PI * glynnsim1_phi1 / 180.0;
glynnsim1_x1 = glynnsim1_radius * cos(tmp);
glynnsim1_y1 = glynnsim1_radius * sin(tmp);
glynnsim1_abspow = abs(glynnsim1_pow);
glynnsim2_phi10 = PI * glynnsim2_phi1 / 180.0;
glynnsim2_phi20 = PI * glynnsim2_phi2 / 180.0;
glynnsim2_gamma = glynnsim2_thickness * (2.0 * glynnsim2_radius + glynnsim2_thickness) / (glynnsim2_radius + glynnsim2_thickness);
glynnsim2_delta = glynnsim2_phi20 - glynnsim2_phi10;
glynnsim2_abspow = abs(glynnsim2_pow);
glynnsim3_radius1 = glynnsim3_radius + glynnsim3_thickness;
glynnsim3_radius2 = sq(glynnsim3_radius) / glynnsim3_radius1;
glynnsim3_gamma = glynnsim3_radius1 / (glynnsim3_radius1 + glynnsim3_radius2);
glynnsim3_abspow = abs(glynnsim2_pow);
hexes_obj = new Hexes(hexes_cellsize, hexes_power, hexes_rotate, hexes_scale);
hypertile1_pa = TWO_PI / hypertile1_p;
tmp = 1.0 - (cos(TWO_PI / hypertile1_p) - 1.0) / (cos(TWO_PI / hypertile1_p) + cos(TWO_PI / hypertile1_q));
if(tmp>0) hypertile1_r = 1.0 / sqrt(tmp); else hypertile1_r=1.0;
hypertile2_pa = TWO_PI / hypertile2_p;
tmp = 1.0 - (cos(TWO_PI / hypertile2_p) - 1.0) / (cos(TWO_PI / hypertile2_p) + cos(TWO_PI / hypertile2_q));
if(tmp>0) hypertile2_r = 1.0 / sqrt(tmp); else hypertile2_r=1.0;
tmp = TWO_PI / hypertile_p;
tmp2 = TWO_PI / hypertile_q;
float tmp3 = (1.0 - cos(tmp)) / ((cos(tmp) + cos(tmp2)) + 1.0);
if(tmp3 > 0) tmp3 = 1.0/sqrt(tmp3); else tmp3 = 1.0;
tmp2 = hypertile_n * tmp;
hypertile_re = tmp3 * cos(tmp2);
hypertile_im = tmp3 * sin(tmp2);
asteria_sina = sin(PI*asteria_alpha);
asteria_cosa = cos(PI*asteria_alpha);
tmp = 0.5 * ( bwrands_cellsize / (1.0 + sq(bwrands_space)));
bwrands_g2 = sq(bwrands_gain) / tmp + 1.0e-6;
tmp2 = bwrands_g2 * tmp;
if(tmp2 > 2.0) tmp2 = 1.0;
else tmp2 *= 1.0 / ( sq(tmp2)/4.0 + 1.0);
bwrands_r2 = sq(tmp);
bwrands_rfactor = tmp / tmp2;
bwrands_petx = min(bwrands_minpetals,bwrands_maxpetals);
bwrands_pety = abs(bwrands_maxpetals - bwrands_minpetals);
juliaq_half_inv_power = 0.5 * juliaq_divisor / juliaq_power;
juliaq_inv_power = juliaq_divisor / juliaq_power;
juliaq_inv_power_2pi = TWO_PI / juliaq_power;
if(lazyjess_n < 2) lazyjess_n = 2;
lazyjess_vertex = PI * (lazyjess_n - 2) / (2 * lazyjess_n);
lazyjess_sin_vertex = sin(lazyjess_vertex);
lazyjess_pie_slice = TWO_PI/ lazyjess_n;
lazyjess_half_slice = lazyjess_pie_slice / 2;
lazyjess_corner_rotation = (lazyjess_corner - 1) * lazyjess_pie_slice;
logapo_denom = 0.5 / log(logapo_base);
logdb_denom = 0.5;
if(logdb_base > 1.0e-10)
logdb_denom = logdb_denom / log(2.71828182845905 * logdb_base);
logdb_fixpe = PI;
if(logdb_fix_period > 1.0e-10)
logdb_fixpe *= logdb_fix_period;
loonie2_sqrvvar = sq(loonie2_weight);
tmp = TWO_PI / loonie2_sides;
loonie2_sina = sin(tmp);
loonie2_cosa = cos(tmp);
tmp = -TWO_PI / loonie2_star;
loonie2_sins = sin(tmp);
loonie2_coss = cos(tmp);
tmp = TWO_PI / loonie2_circle;
loonie2_sinc = sin(tmp);
loonie2_cosc = cos(tmp);
loonie3_sqrvvar = sq(loonie3_weight);
if(nblur_numedges < 3) nblur_numedges = 3;
if(nblur_numstripes != 0) {
nblur_hasStripes = 1;
if(nblur_numstripes < 0) {
nblur_negStripes = 1;
nblur_numstripes *= -1;
} else nblur_negStripes = 0;
} else {
nblur_hasStripes = 0;
nblur_negStripes = 0;
}
nblur_midAngle = TWO_PI / nblur_numedges;
if(nblur_hasStripes == 1) {
nblur_angStripes = nblur_midAngle / (2*nblur_numstripes);
nblur_angStart = nblur_angStripes / 2.0;
nblur_ratiocomplement = 2.0 - nblur_ratiostripes;
}
if(nblur_ratiohole>0.95 && nblur_exactcalc==1 && nblur_circumcircle==0)
nblur_ratiohole = 0.95;
nblur_tan90_m_2 = tan(HALF_PI + nblur_midAngle / 2.0);
tmp = nblur_midAngle / 2.0;
nblur_sina = sin(tmp);
nblur_cosa = cos(tmp);
if(nblur_highlightedges <= 0.1) nblur_highlightedges = 0.1;
if(nblur_adjusttolinear == 1) {
if(nblur_numedges%4==0)
nblur_weight /= sqrt(2.0 - 2.0 * cos(nblur_midAngle * (nblur_numedges/2.0-1.0)))/2.0;
else
nblur_weight /= sqrt(2.0 - 2.0 * cos(nblur_midAngle * floor(nblur_numedges/2.0)))/2.0;
}
if(nblur_circumcircle==1) {
nblur_exactcalc = 0;
nblur_highlightedges = 0.1;
}
nblur_speedCalc1 = nblur_ratiocomplement * nblur_angStart;
nblur_speedCalc2 = nblur_ratiostripes * nblur_angStart;
nblur_maxStripes = 2*nblur_numstripes;
if(nblur_negStripes == 0) {
nblur_arc_tan1 = (13.0/pow(nblur_numedges,1.3))*nblur_highlightedges;
nblur_arc_tan2 = (2.0*atan(nblur_arc_tan1)/-2.0);
} else {
nblur_arc_tan1 = (7.5/pow(nblur_numedges,1.3))*nblur_highlightedges;
nblur_arc_tan2 = (2.0*atan(nblur_arc_tan1)/-2.0);
}
}
PVector oscilloscope2(PVector p, float weight) {
float t, pt = oscilloscope2_perturbation * sin(oscilloscope2_frequencyy * p.y);
if(abs(oscilloscope2_damping)<1.0e-6) {
t = oscilloscope2_amplitude * (cos(oscilloscope2_frequencyx * p.x + pt)) + oscilloscope2_separation;
} else {
t = oscilloscope2_amplitude * exp(-abs(p.x)*oscilloscope2_damping) * (cos(oscilloscope2_frequencyx * p.x + pt)) + oscilloscope2_separation;
}
if(abs(p.y)<=t) {
return new PVector(weight * -p.x, weight * -p.y);
} else {
return new PVector(weight * p.x, weight * p.y);
}
}
PVector devilwarp(PVector p, float weight) {
float r2 = 1.0 / p.magSq();
float r = pow(sq(p.x) + r2 * devilwarp_b * sq(p.y),devilwarp_warp) - pow(sq(p.y) + r2 * devilwarp_a * sq(p.x), devilwarp_warp);
if(r>devilwarp_rmax) r = devilwarp_rmax;
else if(r< devilwarp_rmin) r = devilwarp_rmin;
r = devilwarp_effect * r;
return new PVector(p.x * (1+r), p.y*(1+r));
}
PVector bsplit(PVector p, float weight) {
if(p.x+bsplit_shiftx == 0 || p.x + bsplit_shiftx == PI) {
return new PVector(weight * p.x,weight * p.y);
} else {
float xx = weight / tan(p.x+bsplit_shiftx) * cos(p.y + bsplit_shifty);
float yy = weight / sin(p.x+bsplit_shiftx) * (-1 * p.y + bsplit_shifty);
return new PVector(xx,yy);
}
}
class randXYData {
float x,y;
float lenXY, lenOuterEdges, lenInnerEdges;
}
void randXY(randXYData d) {
float x, y;
float xTmp, yTmp, lenOuterEdges = d.lenOuterEdges, lenInnerEdges=d.lenOuterEdges;
float angXY, lenXY=d.lenXY;
float ranTmp, angTmp, angMem;
float ratioTmp, ratioTmpNum, ratioTmpDen;
float speedCalcTmp;
int count;
if(nblur_exactcalc == 1)
angXY = random(1)*TWO_PI;
else
angXY = (atan(nblur_arc_tan1*(random(1)-0.5))/(nblur_arc_tan2)+0.5 + ((int)random(32767))%((int)nblur_numedges)) * nblur_midAngle;
x=sin(angXY);
y=cos(angXY);
angMem = angXY;
while(angXY>nblur_midAngle)
angXY -= nblur_midAngle;
if(nblur_hasStripes == 1) {
angTmp = nblur_angStart;
count = 0;
while(angXY > angTmp) {
angTmp += nblur_angStripes;
if(angTmp > nblur_midAngle) angTmp = nblur_midAngle;
count++;
}
if(angTmp!=nblur_midAngle) angTmp -= nblur_angStart;
if(nblur_negStripes == 0) {
if(count%2==1) {
if(angXY>angTmp) {
angXY = angXY + nblur_angStart;
angMem = angMem + nblur_angStart;
x = sin(angMem);
y = cos(angMem);
angTmp += nblur_angStripes;
count++;
} else {
angXY = angXY - nblur_angStart;
angMem = angMem - nblur_angStart;
x = sin(angMem);
y = cos(angMem);
angTmp -= nblur_angStripes;
count--;
}
}
if(count%2==0 && nblur_ratiostripes >1.0) {
if(angXY > angTmp && count!=nblur_maxStripes) {
angMem = angMem - angXY + angTmp + (angXY-angTmp)/nblur_angStart * nblur_ratiostripes * nblur_angStart;
angXY = angTmp + (angXY-angTmp)/(nblur_angStart) * nblur_ratiostripes * nblur_angStart;
x = sin(angMem);
y = cos(angMem);
} else {
angMem = angMem - angXY + angTmp - (angTmp-angXY)/nblur_angStart * nblur_ratiostripes * nblur_angStart;
angXY = angTmp + (angXY-angTmp)/(nblur_angStart) * nblur_ratiostripes * nblur_angStart;
x = sin(angMem);
y = cos(angMem);
}
}
if(count%2==0 && nblur_ratiostripes<1.0) {
if(abs(angXY-angTmp) > nblur_speedCalc2 && count != nblur_maxStripes) {
if((angXY-angTmp) > nblur_speedCalc2) {
ratioTmpNum = (angXY - (angTmp+nblur_speedCalc2))*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp + ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp + ratioTmp;
}
if((angTmp-angXY) > nblur_speedCalc2) {
ratioTmpNum = (angTmp - nblur_speedCalc2-angXY)*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp - ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp - ratioTmp;
}
}
if(count==nblur_maxStripes) {
if((angTmp-angXY)>nblur_speedCalc2) {
ratioTmpNum = (angTmp - nblur_speedCalc2-angXY)*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp - ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp - ratioTmp;
}
}
}
} else {
ratioTmp = nblur_ratiostripes;
nblur_ratiostripes = nblur_ratiocomplement;
nblur_ratiocomplement = ratioTmp;
speedCalcTmp = nblur_speedCalc1;
nblur_speedCalc1 = nblur_speedCalc2;
nblur_speedCalc2 = speedCalcTmp;
if(count%2==0) {
if(angXY>angTmp && count != nblur_maxStripes) {
angXY = angXY + nblur_angStart;
angMem = angMem + nblur_angStart;
x = sin(angMem);
y = cos(angMem);
angTmp += nblur_angStripes;
count++;
} else {
angXY = angXY - nblur_angStart;
angMem = angMem - nblur_angStart;
x = sin(angMem);
y = cos(angMem);
angTmp -= nblur_angStripes;
count--;
}
}
if(count%2==1 && nblur_ratiostripes >1.0) {
if(angXY > angTmp && count!=nblur_maxStripes) {
angMem = angMem - angXY + angTmp + (angXY-angTmp)/nblur_angStart * nblur_ratiostripes * nblur_angStart;
angXY = angTmp + (angXY-angTmp)/(nblur_angStart) * nblur_ratiostripes * nblur_angStart;
x = sin(angMem);
y = cos(angMem);
} else {
angMem = angMem - angXY + angTmp - (angTmp-angXY)/nblur_angStart * nblur_ratiostripes * nblur_angStart;
angXY = angTmp + (angXY-angTmp)/(nblur_angStart) * nblur_ratiostripes * nblur_angStart;
x = sin(angMem);
y = cos(angMem);
}
}
if(count%2==1 && nblur_ratiostripes<1.0) {
if(abs(angXY-angTmp) > nblur_speedCalc2 && count != nblur_maxStripes) {
if((angXY-angTmp) > nblur_speedCalc2) {
ratioTmpNum = (angXY - (angTmp+nblur_speedCalc2))*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp + ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp + ratioTmp;
}
if((angTmp-angXY) > nblur_speedCalc2) {
ratioTmpNum = (angTmp - nblur_speedCalc2-angXY)*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp - ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp - ratioTmp;
}
}
if(count==nblur_maxStripes) {
angTmp = nblur_midAngle;
if((angTmp-angXY)>nblur_speedCalc2) {
ratioTmpNum = (angTmp - nblur_speedCalc2-angXY)*nblur_speedCalc2;
ratioTmpDen = nblur_angStart - nblur_speedCalc2;
ratioTmp = ratioTmpNum/ratioTmpDen;
float t = angMem - angXY + angTmp - ratioTmp;
x = sin(t);
y = cos(t);
angXY = angTmp - ratioTmp;
}
}
}
ratioTmp = nblur_ratiostripes;
nblur_ratiostripes = nblur_ratiocomplement;
nblur_ratiocomplement = ratioTmp;
speedCalcTmp = nblur_speedCalc1;
nblur_speedCalc1 = nblur_speedCalc2;
nblur_speedCalc2 = speedCalcTmp;
}
}
xTmp = nblur_tan90_m_2 /(nblur_tan90_m_2 - tan(angXY));
yTmp = xTmp * tan(angXY);
lenOuterEdges = sqrt(sq(xTmp)+sq(yTmp));
if(nblur_exactcalc == 1) {
if(nblur_equalblur == 1) ranTmp = sqrt(random(1));
else ranTmp = random(1);
} else {
if(nblur_circumcircle == 1) {
if(nblur_equalblur == 1) ranTmp = sqrt(random(1));
else ranTmp = random(1);
} else {
if(nblur_equalblur == 1) ranTmp = sqrt(random(1)) * lenOuterEdges;
else ranTmp = random(1) * lenOuterEdges;
}
}
lenInnerEdges = nblur_ratiohole * lenOuterEdges;
if(nblur_exactcalc == 0) {
if(ranTmp<lenInnerEdges) {
if(nblur_circumcircle == 1) {
if(nblur_equalblur == 1) ranTmp = lenInnerEdges + sqrt(random(1)) * (1.0 - lenInnerEdges + 1.0e-6);
else ranTmp = lenInnerEdges + random(1) * (1.0 - lenInnerEdges + 1.0e-6);
} else {
if(nblur_equalblur == 1) ranTmp = lenInnerEdges + sqrt(random(1)) * (lenOuterEdges - lenInnerEdges);
else ranTmp = lenInnerEdges + random(1) * (lenOuterEdges - lenInnerEdges);
}
}
}
x*=ranTmp;
y*=ranTmp;
lenXY = sqrt(sq(x)+sq(y));
d.x = x;
d.y = y;
d.lenXY = lenXY;
d.lenInnerEdges = lenInnerEdges;
d.lenOuterEdges = lenOuterEdges;
}
PVector nblur(PVector p, float weight) {
randXYData data = new randXYData();
randXY(data);
if(nblur_exactcalc == 1 && nblur_circumcircle == 0)
while( (data.lenXY < data.lenInnerEdges) || (data.lenXY > data.lenOuterEdges)) randXY(data);
if(nblur_exactcalc == 1 && nblur_circumcircle == 1)
while( (data.lenXY < data.lenInnerEdges)) randXY(data);
float x = nblur_weight * weight * (nblur_cosa * data.x - nblur_sina * data.y);
float y = nblur_weight * weight * (nblur_sina * data.x + nblur_cosa * data.y);
return new PVector(3*x,3*y);
}
PVector murl(PVector p, float weight) {
float c = murl_c;
if( murl_power-1 > 1e-6) {
c/=murl_power = 1.0;
}
float p2 = murl_power / 2.0;
float vp = weight * (c+1);
float a = atan2(p.y,p.x) * murl_power;
float sina = sin(a);
float cosa = cos(a);
float r = c * pow(p.magSq(),p2);
float re = r * cosa + 1.0;
float im = r * sina;
float r1 = vp / (sq(re) + sq(im));
float x = r1 * (p.x * re + p.y * im);
float y = r1 * (p.y * re - p.x * im);
return new PVector(x,y);
}
PVector murl2(PVector p, float weight) {
float p2 = murl2_power / 2.0;
float invp,vp;
if(abs(murl2_power)>1.0e-6) {
invp = 1.0 / murl2_power;
if(murl2_c == -1.0) vp =0.0;
else vp = weight * pow(murl2_c + 1.0, 2.0 / murl2_power);
} else {
invp = 1.0e10;
vp = weight * pow(murl2_c + 1.0, 4);
}
float a = atan2(p.y,p.x) * murl2_power;
float sina = sin(a);
float cosa = cos(a);
float r = murl2_c * pow(p.magSq(),p2);
float re = r * cosa + 1.0;
float im = r * sina;
r = pow(sq(re) + sq(im), invp);
a = atan2(im,re) * 2.0 * invp;
re = r*cos(a);
im = r*sin(a);
float r1 = vp / sq(r);
float x = r1 * (p.x * re + p.y * im);
float y = r1 * (p.y * re - p.x * im);
return new PVector(x,y);
}
PVector mcarpet(PVector p, float weight) {
float t = p.magSq() / 4.0 + 1.0;
float r = 1.0/t;
float x = p.x * r * mcarpet_x;
float y = p.y * r * mcarpet_y;
x += (1.0 - (mcarpet_twist * sq(p.x)) + p.y);
y += mcarpet_tilt * p.x;
return new PVector(weight * x, weight * y);
}
PVector loonie3(PVector p, float weight) {
float r2 = 2 * loonie3_sqrvvar;
if(p.x>1.0e-10) {
r2 = sq(p.magSq() / p.x);
}
float r = weight;
if(r2 < loonie3_sqrvvar) {
r *= sqrt(loonie3_sqrvvar / r2 -1.0);
}
return new PVector(r*p.x,r*p.y);
}
PVector loonie2(PVector p, float weight) {
float xrt = p.x;
float yrt = p.y;
float swp;
float r2 = xrt * loonie2_coss + abs(yrt) * loonie2_sins;
float circle = p.mag();
int i;
for(i =0;i<loonie2_sides-1;i++) {
swp = xrt * loonie2_cosa - yrt * loonie2_sina;
yrt = xrt * loonie2_sina + yrt * loonie2_cosa;
xrt = swp;
r2 = max(r2, xrt * loonie2_coss + abs(yrt) * loonie2_sins);
}
r2 = r2 * loonie2_cosc + circle * loonie2_sinc;
if(i>1)
r2 = sq(r2);
else
r2 = abs(r2)*r2;
float x,y;
if(r2>0 && (r2<loonie2_sqrvvar)) {
float r = weight * sqrt(abs(loonie2_sqrvvar / r2 - 1.0));
x = r*p.x;
y = r*p.y;
} else {
if(r2<0) {
float r = weight / sqrt(abs(loonie2_sqrvvar / r2) - 1.0);
x = r * p.x;
y = r * p.y;
} else {
x = weight * p.x;
y = weight * p.y;
}
}
return new PVector(x,y);
}
PVector logdb(PVector p, float weight) {
float fap = 0.0;
int adp;
for(int i=0;i<7;i++) {
adp = (int)random(-5,5);
if(abs(adp)>=3) adp = 0;
fap += adp;
}
fap *= logdb_fixpe;
float x = weight * logdb_denom * log(p.magSq());
float y = weight * (atan2(p.y,p.x)