linesguy

Fractal spirograph rewrite

Mar 29th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. 0 rem This is a complete re-write of the fractal spirograph program, I don't actually remember why i did this but i figured i might as well upload it anyway since it took me half an hour to do so.
  2. 0 rem By the way, This program is a lot slower than the other fractal spirograph program.
  3.  
  4. 1 K = 4 : rem Number sides -1
  5. 3 O = 10 : rem Number of orbits
  6. 5 S = 3 : rem Size ratio of orbits
  7. 7 R = 50 : rem Radius of first orbit (max size depends on values O, K and S.)
  8.  
  9. 9 A = 0.01 : rem Does.. Something. Maybe accuracy? I can't remember. Code is too messy to find out.
  10.  
  11. 10 hgr2 : hcolor = 3 : sw = 1 : dim R(O) : dim S(O) : dim X(O) : dim Y(O) : dim P(O)
  12.  
  13. 15 R(1) = R : S(1) = A
  14. 20 for RA = 2 to O
  15. 25 re(2) = re(2) + 1
  16. 27 R(RA) = R : S(RA) = A
  17. 30 for RC = 1 to re(2)
  18. 40 R(RA) = R(RA) / S
  19. 50 S(RA) = S(RA) * K
  20. 60 next
  21. 65 if sw = 1 then S(RA) = -S(RA) : sw = -1 : goto 70
  22. 67 if sw = -1 then sw = 1
  23. 70 next
  24. 80 for RA = 1 to O : P(1) = 3.14 : next
  25. 90 X(1) = 140 : Y(1) = 96
  26.  
  27. 100 for RA = 1 to O-1
  28. 110 P(RA) = P(RA) + S(RA)
  29. 120 X(RA+1) = sin(P(RA))*r(RA)+x(RA) : y(RA+1) = cos(p(RA))*r(RA)+y(RA)
  30. 130 next
  31.  
  32. 140 P(O) = P(O) + S(O)
  33. 150 hplot sin(P(O))*r(O)+x(O),cos(P(O))*r(O)+y(O)
  34. 160 goto 100
Advertisement
Add Comment
Please, Sign In to add comment