vitruve.py

Created by schraf

Created on March 24, 2023

908 Bytes


from turtle import *
from math import sqrt
from time import sleep

def aller(x,y):
    penup()
    goto(x-10,y-30)
    pendown()

def carre(r,p=0):
    for _ in range(4):
        fd(r)
        if p: point()
        left(90)

def point():
    pensize(5)
    goto(position())
    pensize(1)
    sleep(.2)

def gt(x,y): goto(x-10,y-30)

phi = (1 + sqrt(5)) / 2
r2 = sqrt(2)
r5 = sqrt(5)
r3 = sqrt(3)
r = 40
d = int(2*r*phi)
e = int((-r+r*r2)/2)
x1 = int((-r+r*r5)/2)
color('grey')
aller(-r,-r)
carre(2*r,1)
sleep(.2)
aller(0,-r)
point()
gt(r,r)
point()
aller(0,-r-r5*r)
circle(int(r5*r))
sleep(.2)
aller(-3*r,-r)
gt(3*r,-r)
gt(r*r5,-r)
point()
aller(r*r5,-r-d)
circle(d)
aller(-r,-r-d)
circle(d)
aller(x1,-r+(r+r*r5)*r3/2)
point()
gt(x1,-r-(r+r*r5)*r3/2)
aller(x1,r)
color('black')
point()
gt(x1,-r)
point()
pensize(2)
circle(2*r)
aller(-r,-r)
carre(int(r+r*r5))
aller(x1,15)
setheading(90)