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 = 5
| petal_length = 100
| # winkel sind in Degree
| alpha = 90 / (num_of_petal-1)
| beta = 2 * alpha
| gamma = 180 - beta
|
| # abgeleitete Länge
| side_length = petal_length * math.cos(math.radians(alpha))
| start_angle = 0
| for petal in range(0, num_of_petal):
| direction = petal * (360 / num_of_petal) + start_angle
| 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()
|
|