Hong-Phuc Bui
2024-05-05 5b8b6be22c49d62726f9e28fb57f6c32835900e9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#! /usr/bin/env python
import turtle
import math
 
num_of_petal = 60
petal_length = 100
# winkel sind in Degree
alpha = 90 / num_of_petal
beta = 2 * alpha
gamma = 180 - beta
 
# abgeleitete Länge
side_length = petal_length * math.cos(math.radians(alpha))
 
for petal in range(0, num_of_petal):
    direction = petal * (360 / num_of_petal)
    turtle.home()
    turtle.left(direction + alpha)
    turtle.fd(side_length)
    turtle.right(beta)
    turtle.fd(side_length)
    turtle.right(gamma)
    turtle.fd(side_length)
    turtle.right(beta)
    turtle.fd(side_length)
 
turtle.done()