koch_fractales


SUBMITTED BY: Guest

DATE: March 27, 2013, 4:33 p.m.

FORMAT: Python

SIZE: 2.6 kB

HITS: 1117

  1. def cubefrac(a,b,c,w,n,div):
  2. i=0
  3. liste=[[w/2,w/2,0], [w/2,-w/2,0], [-w/2,w/2,0], [-w/2,-w/2,0], [0,w/2,w/2], [0,w/2,-w/2], [0,-w/2,w/2], [0,-w/2,-w/2], [w/2,0,w/2], [w/2,0,-w/2], [-w/2,0,+w/2], [-w/2,0,-w/2]]
  4. if n==0:
  5. print""
  6. else:
  7. for i in range(len(liste)):
  8. x, y, z =a+liste[i][0], b+liste[i][1], c+liste[i][2]
  9. print "polyCube -w", w/div, "-h", w/div, "-d", w/div,"-sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;"
  10. print "move -r -os -wd", x, y, z,";"
  11. cubefrac(x,y,z,w/div,n-1,div)
  12. cubefrac(0,0,0,10.0,4,2.9198)
  13. print "polyCube -w", 10, "-h", 10, "-d", 10,"-sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;"
  14. curve -d 1 -p 0 0 0 -p 1 0 0 -k 0 -k 1 ;
  15. duplicate -rr;
  16. move -r -os -wd 1 0 0 ;
  17. rotate -r -ws 0 0 60 ;
  18. duplicate -rr;
  19. move -r -os -wd 1 0 0 ;
  20. rotate -r -ws 0 0 60 ;
  21. duplicate -rr;
  22. move -r -os -wd 1 0 0 ;
  23. rotate -r -ws 0 0 60 ;
  24. duplicate -rr;
  25. move -r -os -wd 1 0 0 ;
  26. rotate -r -ws 0 0 60 ;
  27. duplicate -rr;
  28. move -r -os -wd 1 0 0 ;
  29. rotate -r -ws 0 0 60 ;
  30. duplicate -rr;
  31. move -r -os -wd 1 0 0 ;
  32. rotate -r -ws 0 0 60 ;
  33. duplicate -rr;
  34. move -r -os -wd 1 0 0 ;
  35. rotate -r -ws 0 0 -120 ;
  36. duplicate -rr;
  37. move -r -os -wd 1 0 0 ;
  38. rotate -r -ws 0 0 60 ;
  39. duplicate -rr;
  40. move -r -os -wd 1 0 0 ;
  41. rotate -r -ws 0 0 -120 ;
  42. duplicate -rr;
  43. move -r -os -wd 1 0 0 ;
  44. rotate -r -ws 0 0 60 ;
  45. duplicate -rr;
  46. move -r -os -wd 1 0 0 ;
  47. rotate -r -ws 0 0 60 ;
  48. select -r curve1 curve2 curve3 curve4 ;
  49. group; xform -os -piv 0 0 0;
  50. duplicate -rr;
  51. move -r 3 0 0;
  52. rotate -r -ws 0 0 60 ;
  53. duplicate -rr; scale -r 1 -1 1;
  54. rotate -r -ws 0 0 60 ;
  55. move -r 3 0 0 ;
  56. duplicate -rr; scale -r 1 1 1;
  57. rotate -r -ws 0 0 60 ;
  58. move -r 3 0 0 ;
  59. select -r group1 group2 group3 group4 ;
  60. group; xform -os -piv 0 0 0;
  61. duplicate -rr;
  62. move -r 9 0 0;
  63. rotate -r -ws 0 0 60 ;
  64. duplicate -rr; scale -r 1 -1 1;
  65. rotate -r -ws 0 0 60 ;
  66. move -r 9 0 0 ;
  67. duplicate -rr; scale -r 1 1 1;
  68. rotate -r -ws 0 0 60 ;
  69. move -r 9 0 0 ;
  70. select -r group5 group6 group7 group8 ;
  71. group; xform -os -piv 0 0 0;
  72. duplicate -rr;
  73. move -r 27 0 0;
  74. rotate -r -ws 0 0 60 ;
  75. duplicate -rr; scale -r 1 -1 1;
  76. rotate -r -ws 0 0 60 ;
  77. move -r 27 0 0 ;
  78. duplicate -rr; scale -r 1 1 1;
  79. rotate -r -ws 0 0 60 ;
  80. move -r 27 0 0 ;

comments powered by Disqus