Mathober 2026 ยท day 7, Five Circles Theorem
Five Circles Theorem
let t1=0
let points = []
function setup() {
theSizeThatFits = min(windowWidth, windowHeight)*0.9
theCanvasThatIsFilled=createCanvas(theSizeThatFits, theSizeThatFits);
background(20,70,80);
strokeWeight(0.5);
describe("5 circles around a circle with a star form from lines connecting intersection the scalled into the center and spun to make a spiral")
stroke(200,240,255)
noFill()
d = random(width/4, width/2.5)
a1 = PI*2/5
d2 = d/2*(sqrt(5)-1)
for(let i = 0;i<5;i++){
a = i*PI/2.5
points[i]=createVector(d/2*cos(a+PI/5),d/2*sin(a+PI/5))
}
}
function draw() {
background(20,70,80,150);
t1=2*PI*sin(frameCount/10000);
translate(width/2,height/2)
for(let j = 0;j<10;j++){
scale(1-j/11)
rotate(t1)
circle(0,0,d)
for(let i = 0;i<5;i++){
a = i*PI/2.5
circle(d/2*cos(a),d/2*sin(a),d2)
circle(d/2*cos(a+PI/5),d/2*sin(a+PI/5),4)
lineThrough(points[i].x,points[i].y,points[(i+1)%5].x,points[(i+1)%5].y)
}
lineThrough(points[0].x,points[0].y,points[1].x,points[1].y)
}
}
function keyPressed(){
if(keyCode===83){
save(theCanvasThatIsFilled,"five","png")
}
}
function lineThrough(x1, y1, x2, y2) {
const dx = x2 - x1, dy = y2 - y1;
const k = (width + height) /dist(x1,y1,x2,y2);
line(x1 - dx * k, y1 - dy * k, x1 + dx * k, y1 + dy * k);
}