Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. def CreationPoints(Iteration, X, Y):
  2. P1 = [(1 + X*3)/(3^Iteration), (1 + Y*3)/(3^Iteration)]
  3. P4 = [(2 + X*3)/(3^Iteration), (1 + Y*3)/(3^Iteration)]
  4. P2 = [(1 + X*3)/(3^Iteration), (2 + Y*3)/(3^Iteration)]
  5. P3 = [(2 + X*3)/(3^Iteration), (2 + Y*3)/(3^Iteration)]
  6.  
  7. return [P1, P2, P3, P4]
  8.  
  9.  
  10. def AffichageCarre(ListPoints):
  11. Carre = polygon([ListPoints[0],
  12. ListPoints[1],
  13. ListPoints[2],
  14. ListPoints[3],
  15. ListPoints[0]], aspect_ratio = 1)
  16. return Carre
  17.  
  18.  
  19. def AffichageListCarre(ListCarre):
  20. H = AffichageCarre(ListCarre[0])
  21. for i in range(1, len(ListCarre)):
  22. H += AffichageCarre(ListCarre[i])
  23. return H
  24.  
  25. def CreationLCarre(Iteration, ListCarre):
  26. for X in range(0,(3^Iteration)):
  27. for Y in range(0,(3^Iteration)):
  28. ListCarre.append(CreationPoints(Iteration, X, Y))
  29. return ListCarre
  30.  
  31.  
  32.  
  33. ListCarre = []
  34. ListCarre = CreationLCarre(0, ListCarre)
  35.  
  36.  
  37. ListCarre += CreationLCarre(1, ListCarre)
  38. ListCarre += CreationLCarre(2, ListCarre)
  39. ListCarre += CreationLCarre(3, ListCarre)
  40. ListCarre += CreationLCarre(4, ListCarre)
  41. print(len(ListCarre))
  42.  
  43.  
  44. Test = AffichageListCarre(ListCarre)
  45.  
  46.  
  47. Test.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement