Thursday, December 31, 2020

Chaotic Maps in Processing 3, The Sinai Map

The pattern is generated with the following code:

//Attractors
float a = 2.25;
//Initial values
float x = 1;
float y = 1;
void setup() {
  frameRate(60);
  size(800,600);
  colorMode(RGB, 255, 255, 255);
  background(0);
  stroke(255, 255, 255);
  strokeWeight(0.125);
}
void draw() {
  float dx = (x + y + a * cos(TAU * y)) % 1;
  float dy = (x + 2 * y) % 1;
  x = dx;
  y = dy;
  translate(width / 2, height / 2);
  point(x * 96, y * 96);
}

It creates the following image:


 


No comments:

Post a Comment