yazdmich

Parametric surface plotter with rotation - Turing

Jun 1st, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. View.Set ('graphics:752;752,offscreenonly')
  2.  
  3. const midx := maxx div 2
  4. const midy := maxy div 2
  5.  
  6. type cart :
  7. record
  8. m : array 0 .. 752, 0 .. 752 of boolean
  9. x : array 0 .. 752 of int
  10. y : array 0 .. 752 of int
  11. z : array 0 .. 752 of int
  12. end record
  13.  
  14. var x, y, z : int
  15. var map : array 0 .. 720 of cart
  16.  
  17. for q : 0 .. 720
  18. cls
  19. for s : 0 .. midx
  20. for t : 1 .. midy
  21. map (q).x (s) := round (cosd (t) * s) + midx
  22. map (q).y (t) := round (sind (s) * t) + midy
  23. map (q).z (s) := t
  24. x := map (q).x (s) - midx
  25. z := map (q).z (s)
  26. x := round (cosd (q/2) * x - sind (q/2) * z)
  27. map (q).x (s) := x + midx
  28. Draw.Dot(map(q).x(s), map(q).y(t), black)
  29. end for
  30. end for
  31.  
  32. for i : 0 .. maxx
  33. for o : 0 .. maxy
  34. if whatdotcolour(i,o) = 7 then
  35. map(q).m(i,o) := true
  36. else
  37. map(q).m(i,o) := false
  38.  
  39. end if
  40. end for
  41. end for
  42.  
  43. Draw.FillArc (midx, midy, 100, 100, 90, round(q/2) + 90, red)
  44. locate (1, 1)
  45. put round ((q / 720) * 1000) / 10, '%'
  46. View.Set ('title:Rendering: ' + realstr (round ((q / 720) * 1000) / 10, 3) + '% complete')
  47. View.Update
  48. end for
  49.  
  50. cls
  51. View.Update
  52. Input.Pause
  53.  
  54. loop
  55. for q : 0 .. 720
  56. cls
  57. for s : 0 .. maxx
  58. for t : 0 .. maxy
  59. if map(q).m(s,t) then
  60. Draw.Dot (s, t, black)
  61.  
  62. end if
  63. end for
  64. end for
  65. View.Update
  66. end for
  67. cls
  68. Input.Pause
  69. end loop
Advertisement
Add Comment
Please, Sign In to add comment