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)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.