Code Chapter 3 Chaos

Mira

back

/*from H.A. Lauwerier Graphics&Fractals, 1994 chapter 6 MIRADSX1 translated into Processing by J.G.van Unnik, 2010*/ let a = -0.05,k = 2; let x1 = 9.8,y1 = 0; let p1 = 1; let x2 = 20,y2 = 0; let p2 = 4; let x3 = 15,y3 = 0; let p3 = 2; let x4 = 2,y4 = 0; let p4 = 4; let x5 = 18,y5 = 0; let p5 = 2; let x6 = 25,y6 = 0; let p6 = 6; let x7 = 7.5,y7 = 0; let p7 = 4; function setup() { createCanvas(800, 800); background(0); stroke(255); noLoop(); } function draw() { translate(400, 400); stroke("lightblue"); let x = x1, y = y1, p = p1; orbit(x, y, p); stroke("darkblue"); x = x2; y = y2; p = p2; orbit(x, y, p); stroke("lightgreen"); x = x3; y = y3; p = p3; orbit(x, y, p); stroke("chocolate"); x = x4; y = y4; p = p4; orbit(x, y, p); stroke("darkorange"); x = x5; y = y5; p = p5; orbit(x, y, p); stroke("yellow"); x = x6; y = y6; p = p6; orbit(x, y, p); stroke("white"); x = x7; y = y7; p = p7; orbit(x, y, p); } function orbit( x, y, p){ let c=2-2*a; let kmax=8000*p; let w=a*x+c*x*x/(1+x*x); for(let k=0;k

Mira1

back

/*from H.A. Lauwerier Graphics&Fractals, 1994 chapter 6 MIRADSX1 translated into Processing by J.G.van Unnik, 2010*/ let a=0.3,k=2; let x1=7,y1=0;let p1=2; let x2=-12,y2=0;let p2=2; let x3=-21,y3=0;let p3=2; let x4=5,y4=0;let p4=1; let x5=9,y5=1;let p5=1; let x6=5,y6=0;let p6=1; let x7=7,y7=1;let p7=0.5; function setup() { createCanvas(800,800); background(0); stroke(255); noLoop(); } function draw(){ translate(400,400); stroke('lightblue'); let x=x1,y=y1, p=p1; orbit(x,y,p); stroke('darkblue'); x=x2;y=y2;p=p2; orbit(x,y,p); stroke('lightgreen'); x=x3;y=y3;p=p3; orbit(x,y,p); stroke('chocolate'); x=x4;y=y4;p=p4; orbit(x,y,p); stroke('darkorange'); x=x5;y=y5;p=p5; orbit(x,y,p); stroke('yellow'); x=x6;y=y6;p=p6; orbit(x,y,p); stroke('white'); x=x7;y=y7;p=p7; orbit(x,y,p); } function orbit( x, y, p){ let c=2-2*a; let kmax=8000*p; let w=a*x+c*x*x/(1+x*x); for(let k=0;k

Mira2

back

/*from H.A. Lauwerier Graphics&Fractals, 1994 chapter 6 MIRADSX1 translated into Processing by J.G.van Unnik, 2010*/ let a=0.3,k=2; let x1=8,y1=0;let p1=2; let x2=-20,y2=0;let p2=2; let x3=-15,y3=0;let p3=6; let x4=-5.3,y4=0;let p4=2; let x5=9,y5=0;let p5=2; let x6=0,y6=0;let p6=0; let x7=0,y7=0;let p7=0; function setup() { createCanvas(800,800); background(0); stroke(255); noLoop(); } function draw(){ translate(400,400); stroke('lightblue'); let x=x1,y=y1, p=p1; orbit(x,y,p); stroke('darkblue'); x=x2;y=y2;p=p2; orbit(x,y,p); stroke('lightgreen'); x=x3;y=y3;p=p3; orbit(x,y,p); stroke('chocolate'); x=x4;y=y4;p=p4; orbit(x,y,p); stroke('darkorange'); x=x5;y=y5;p=p5; orbit(x,y,p); stroke('yellow'); x=x6;y=y6;p=p6; orbit(x,y,p); stroke('white'); x=x7;y=y7;p=p7; orbit(x,y,p); } function orbit( x, y, p){ let c=2-2*a; let kmax=4000*p; let w=a*x+c*x*x/(1+x*x); for(let k=0;k

back