Advertisement
Guest User

Processing script for bifurcation of king dream fractal

a guest
Aug 4th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. float a, b, c, d, x, y, xp, yp;
  2. PFont f;
  3.  
  4. void setup() {
  5. size(1500, 1000);
  6. f = createFont("Arial", 16, true);
  7. a = 0.59;
  8. b = 3;
  9. c = -1.4;
  10. d = 1.2;
  11. xp = random(-2, 2);
  12. yp = random(-2, 2);
  13. background(0);
  14. fill(255, 0, 0);
  15. noStroke();
  16. textFont(f, 20);
  17. text("a = " + str(a) + "\nb = " + str(b) + "\nc = " + str(c) + "\nd = " + str(d), 10, 30);
  18. }
  19.  
  20. void draw() {
  21. //background(0);
  22. for (int j = 0; j < 100; j++) {
  23. xp = random(-2, 2);
  24. yp = random(-2, 2);
  25. for (int i = 0; i < 100000; i++) {
  26. x = sin(yp * b) - c * sin(xp * b);
  27. y = sin(xp * a) + d * sin(yp * a);
  28. if (i > 5000) {set(int(map(a, 0.59, 0.75, 0, 1500)), int(map(y, -3, 3, 1000, 0)), color(255));}
  29. xp = x;
  30. yp = y;
  31. }
  32. a += 0.00001;
  33. println(a);
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement