msollami

Julia Cubes

Dec 14th, 2011
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. S[q_] := Module[{x, y, e = Sqrt[Plus @@ Map[#^2 &, q]]},
  2. x = Sqrt[(q[[1]] + e)/2];
  3. y = (e - q[[1]]) x/(q[[2]]^2 + q[[3]]^2 + q[[4]]^2);
  4. {x, y q[[2]], y q[[3]], y q[[4]]}
  5. ];
  6. Q[qc_, qlist_] :=
  7. Flatten[
  8. Map[
  9. Module[{q = S[# - (qc~Join~{0, 0})]}, {q, -q}] &,
  10. qlist
  11. ], 1];
  12. MakeFractal[qc_] := Module[{qlist = {{1.0, 1.0, 1.0, 1.0}}},
  13. Do[qlist = Q[qc, qlist], {6}];
  14. Graphics3D[
  15. {Specularity[White, 6],
  16. {Hue[#[[4]]], Cuboid[Delete[#, 4], Delete[#, 4] + 0.06]} & /@
  17. qlist
  18. },
  19. Lighting -> "Neutral",
  20. Boxed -> False,
  21. Background -> RGBColor[0, 0, 0],
  22. ImageSize -> {800, 800}
  23. ]
  24. ];
  25. DynamicModule[{pt = {0, 0}},
  26. LocatorPane[Dynamic[pt], Dynamic@MakeFractal[pt], {{-1, -1}, {1, 1}}
  27. , AutoAction -> True, ImageSize -> {800, 800}]
  28. ]
Advertisement
Add Comment
Please, Sign In to add comment