Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def CreationPoints(Iteration, X, Y):
- P1 = [(1 + X*3)/(3^Iteration), (1 + Y*3)/(3^Iteration)]
- P4 = [(2 + X*3)/(3^Iteration), (1 + Y*3)/(3^Iteration)]
- P2 = [(1 + X*3)/(3^Iteration), (2 + Y*3)/(3^Iteration)]
- P3 = [(2 + X*3)/(3^Iteration), (2 + Y*3)/(3^Iteration)]
- return [P1, P2, P3, P4]
- def AffichageCarre(ListPoints):
- Carre = polygon([ListPoints[0],
- ListPoints[1],
- ListPoints[2],
- ListPoints[3],
- ListPoints[0]], aspect_ratio = 1)
- return Carre
- def AffichageListCarre(ListCarre):
- H = AffichageCarre(ListCarre[0])
- for i in range(1, len(ListCarre)):
- H += AffichageCarre(ListCarre[i])
- return H
- def CreationLCarre(Iteration, ListCarre):
- for X in range(0,(3^Iteration)):
- for Y in range(0,(3^Iteration)):
- ListCarre.append(CreationPoints(Iteration, X, Y))
- return ListCarre
- ListCarre = []
- ListCarre = CreationLCarre(0, ListCarre)
- ListCarre += CreationLCarre(1, ListCarre)
- ListCarre += CreationLCarre(2, ListCarre)
- ListCarre += CreationLCarre(3, ListCarre)
- ListCarre += CreationLCarre(4, ListCarre)
- print(len(ListCarre))
- Test = AffichageListCarre(ListCarre)
- Test.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement