fractalkitty looking for math? fractalkitty.com

Mathober 2025

Strongly

#random#trig#animation#math#geometry#mathober

points1points2

let t = 0;
let points1, points2, r1, r2;
function setup() {
  createCanvas(500, 500);
  background(255);
  describe(
    "A strongly regular graph with 16 points where 8 on the outside and 8 in the inside. The outer part is octagonal and the inner is more star like"
  );
  noFill();
  rectMode(CENTER);
  points1 = [];
  points2 = [];
  r1 = width / 3;
  r2 = width / 5;
  cnt = 0;
  for (let i = -16; i <= 16; i++) {
    points1[cnt] = {
      x: r1 * cos((i * 2 * PI) / 8),
      y: r1 * sin((i * 2 * PI) / 8)
    };
    points2[cnt] = {
      x: r2 * cos(PI / 8 + (i * 2 * PI) / 8),
      y: r2 * sin(PI / 8 + (i * 2 * PI) / 8)
    };
    cnt++;
  }
}

function draw() {
  background(245, 250, 255, 30);
  t += 0.01;
  translate(width / 2, height / 2);
  n = 25;
  d = width / n;
  stroke(100, 110, 120, 10);
  for (let i = 0; i < n; i++) {
    push();
    rotate(((2 * PI) / n) * i);
    strokeWeight(0.5);
    line(-width / 1.5, 0, width / 1.5, 0);

    circle(0, 0, (width / n) * 2 * i);
    pop();

    for (let i = 0; i < 1000; i++) {
      push();
      strokeWeight(1);
      stroke(245, 250, 255);
      fill(245, 250, 255);
      x = random(-width / 2, width / 2);
      y = random(-width / 2, width / 2);
      circle(x, y, 1);
      pop();
    }

    stroke(75, 85, 95, 20);
    fill(75, 85, 95);

    strokeWeight(0.5);
    for (let i = 4; i < 12; i++) {
      push();
      circle(points1[i].x, points1[i].y, 10);
      circle(points2[i].x, points2[i].y, 10);
      fill(75, 85, 95, 20);
      for (let j = 0; j < 5; j++) {
        r = random(-10, 10);
        theta = random(0, 2 * PI);
        circle(
          points1[i].x + r * cos(theta),
          points1[i].y + r * sin(theta),
          random(1, 4)
        );
        circle(
          points2[i].x + r * cos(theta),
          points2[i].y + r * sin(theta),
          random(1, 4)
        );
      }
      line(points1[i].x, points1[i].y, points1[i + 1].x, points1[i + 1].y);
      line(points1[i].x, points1[i].y, points1[i + 2].x, points1[i + 2].y);
      line(points1[i].x, points1[i].y, points2[i].x, points2[i].y);
      line(points1[i].x, points1[i].y, points2[i - 1].x, points2[i - 1].y);
      line(points2[i].x, points2[i].y, points2[i + 2].x, points2[i + 2].y);

      line(points2[i].x, points2[i].y, points2[i - 3].x, points2[i - 3].y);

      pop();
    }
    noFill();
  }
  strokeWeight(1);
  stroke(100, 110, 120, 30);
  rect(0, 0, width / 1.02, width / 1.02);
  rect(0, 0, width / 1.04, width / 1.04);
}