Advertisement
Guest User

Untitled

a guest
Apr 5th, 2014
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. torus[phiOffset_, thetaOffset_] := Module[{
  2. R = 10,
  3. r = 4,
  4. colors = {RGBColor[1, 1, 0.4588], RGBColor[0.8, 0.2667, 0.8549],
  5. RGBColor[0.2667, 0.7412, 0.8863]},
  6. density = 10,
  7. nrOfRings = 80
  8. },
  9. Show[
  10. ParametricPlot3D[{
  11. (R + r Cos[phi]) Cos[theta],
  12. (R + r Cos[phi]) Sin[theta],
  13. r Sin[phi]
  14. },
  15. {phi, 0, 2 Pi},
  16. {theta, 0, 2 Pi},
  17. Mesh -> False,
  18. PlotStyle -> Black
  19. ],
  20. Graphics3D[{
  21. Array[
  22. Function[ringNr,
  23. MapIndexed[{#,
  24. Point[{
  25. (R + (r + 0.01) Cos[
  26. First@#2 2 Pi/(density Length[colors]) +
  27. phiOffset]) Cos[ringNr 2 Pi/nrOfRings + thetaOffset],
  28. (R + (r + 0.01) Cos[
  29. First@#2 2 Pi/(density Length[colors]) +
  30. phiOffset]) Sin[ringNr 2 Pi/nrOfRings + thetaOffset],
  31. r Sin[First@#2 2 Pi/(density Length[colors]) + phiOffset]
  32. }]
  33. } &,
  34. RotateLeft[
  35. Flatten@ConstantArray[colors, density Length[colors]], ringNr]
  36. ]],
  37. nrOfRings
  38. ]
  39. }],
  40. Axes -> None,
  41. Boxed -> False,
  42. Background -> Black,
  43. ImageSize -> 500
  44. ]
  45. ]
  46. Array[torus[-#, #/5] &, 20, 10 Pi] // ListAnimate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement