Matthen

Taking a Dual

Jun 4th, 2011
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. scale[shape_, t_] := Module[{faces = PolyhedronData[shape, "Faces"]},
  2. faces[[1]] = Map[t, faces[[1]]];
  3. faces
  4. ];
  5. scaleV[shape_, t_] :=
  6. Module[{coords = PolyhedronData[shape, "VertexCoordinates"]},
  7. Map[t, coords]
  8. ];
  9. fade[a_, t_] := (Tanh[10 (t - a)] + 1)/2;
  10. frame[t_] :=
  11. Graphics3D[{
  12. Opacity[If[t < 0.45, 1 - fade[0.2, t]/2, 1 - fade[0.45, t]]], Red,
  13. If[t < 0.77, scale["Cube", # &], Opacity[1]],
  14. Opacity[1 - fade[0.5, t]/2], Blue,
  15. If[t < 0.8, Sphere[{0, 0, 0}, 1/2], Opacity[1]],
  16. Opacity[fade[0.4, t]], Green,
  17. If[t < 1.1, Point[scaleV["Octahedron", #/Sqrt[2] &]], Opacity[1]],
  18. Opacity[If[t < 1.1, 1 - fade[0.8, t]/2, 1 - fade[1.1, t]]],
  19. If[t < 1.2, scale["Octahedron", #/Sqrt[2] &], Opacity[1]],
  20. Opacity[fade[1, t]], Blue,
  21. Opacity[1 - fade[1.4, t]],
  22. Sphere[{0, 0, 0}, 1/(2 Sqrt[3])],
  23. Opacity[1],
  24. Red,
  25. Opacity[fade[0.84, t]],
  26. Point[scaleV["Cube", #/3 &]],
  27. Opacity[1],
  28. scale["Cube", #*
  29. If[t < 1.6, 1/3, If[t < 2, 1/3 + 5/3 (t - 1.6), 1]] &]
  30. }
  31. , Boxed -> False,
  32. PlotRange -> {{-0.6, 0.6}, {-0.6, 0.6}, {-0.6, 0.6}},
  33. ViewPoint -> {3 Sin[t Pi/4], 3 Cos[t Pi/4], 2}];
  34. Manipulate[frame[t], {t, 0, 2}]
Advertisement
Add Comment
Please, Sign In to add comment