Latööcarfian Generator (Processing)
/** Latööcarfian Generator | |
* | |
* Based on code on pg. 26 of _Chaos in Wonderland_ | |
* by Clifford A. Pickover | |
* Good ranges for a, b, c, and d: | |
* (-3 < a, b < 3) | |
* (0.5 < c, d < 1.5) | |
*/ | |
float a = 1.5641136; | |
float b = 2.7102947; | |
float c = 0.9680385; | |
float d = 0.995141; | |
float x, y = 0.1; | |
int counter = 0; | |
int iterations = 500000; | |
void setup() { | |
size(700,700,P2D); // remove P2D for Processing v2.0 | |
background(0); // black | |
stroke(255,255,255,90); // white, semi-transparent | |
} | |
void draw() { | |
println(counter); | |
translate(width/2, height/2); // draw from center of window | |
float xNew = sin(y*b) + c * (sin(x*b)); | |
float yNew = sin(x*a) + d * (sin(y*a)); | |
x = xNew; y = yNew; | |
point(x*100, y*100); | |
counter++; | |
if(counter >= iterations) { | |
println("done!"); | |
noLoop(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment