Artificial River Deltas

These images were generated with this small Processing script:


/// Parameters ///
int RING_RADIUS = 1000;
int TICK_LIMIT = 600;
int ITERS = 5000;
int NOISE_MAG = 900;
int DIR_MULT = 4;
color RING_COLOR = #189534;
color BACKGROUND_COLOR = #04363E;
//////////////////

void setup() {
  size(3000, 3000);
  background(BACKGROUND_COLOR);
  stroke(BACKGROUND_COLOR);
  fill(RING_COLOR);
  ellipseMode(CENTER);
  ellipse(width/2, height/2, RING_RADIUS*2, RING_RADIUS*2);

  PVector pos = new PVector(0, 0);
  PVector dir = new PVector(0, 0);
  int ticker = 0;
  int iters = 0;
  while (iters < ITERS) {
    if ((dist(pos.x, pos.y, width/2, height/2) > RING_RADIUS) || ticker > TICK_LIMIT) {
      float circle_offset = random(0.0, 1.0);
      pos.x = (width/2) + (RING_RADIUS * cos(TAU*(1.0/ITERS)*iters));
      pos.y = (height/2) + (RING_RADIUS * sin(TAU*(1.0/ITERS)*iters));
      dir = new PVector(0, 0);
      ticker = 0;
      iters++;
    }
    line(pos.x, pos.y, pos.x+dir.x, pos.y+dir.y);
    pos.x += dir.x;
    pos.y += dir.y;
    float dir_delta = noise(pos.x/NOISE_MAG, pos.y/NOISE_MAG);
    dir.x += cos(TAU*dir_delta);
    dir.y += sin(TAU*dir_delta);
    dir.normalize();
    dir.mult(DIR_MULT);
    ticker++;
  }

  save("ARD.png");
  exit();
}