Lesson 1 of 10 · Strange attractors on the GPU

The point

One point. Three rules. An impossible form.

Everything begins with one point. You do not place it: you release it, and three equations decide where it goes, step by step. That thread of light is one point drawing its path.

It never repeats and never escapes. That is a strange attractor: chaos with form.

attractor(p)The rule of motion. It receives where the point is and returns where it goes next. We open it in the following lesson.
Reading the codevec3 attractor(vec3 p): a function. It takes a position in 3D and returns a velocity, also in 3D.
p.x, p.y, p.z: the point’s three coordinates. The third one is depth.
float a=0.95, … f=0.10: the six constants of the Aizawa attractor. Change one and the form changes.
dx, dy, dz: how fast the point moves along each axis, right now.
return vec3(dx, dy, dz): the answer: where the point is heading. The GPU takes the step.
TryMove Stretch and Inflate: they edit d and a in the equation. The form reconfigures instantly.

The code

vec3 attractor(vec3 p){
  // Aizawa · mueve los números y mira
  float a=0.95, b=0.70, c=0.60, d=3.50, e=0.25, f=0.10;
  float dx = (p.z - b)*p.x - d*p.y;
  float dy = d*p.x + (p.z - b)*p.y;
  float dz = c + a*p.z - p.z*p.z*p.z/3.0
           - (p.x*p.x + p.y*p.y)*(1.0 + e*p.z) + f*p.z*p.x*p.x*p.x;
  return vec3(dx, dy, dz);
}