Advertisement
Matthen

Perspective of Cube

Jun 20th, 2013
607
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. ps = {{0, 0}, {1, 0}, {1, 1}, {0, 1}, {0.5, 0.5}, {1.5, 0.5}, {1.5,
  2. 1.5}, {0.5, 1.5}};
  3. edges = {{1, 2}, {2, 3}, {3, 4}, {4, 1}, {5, 6}, {6, 7}, {7, 8}, {8,
  4. 5}, {1, 5}, {2, 6}, {3, 7}, {4, 8}};
  5. faces = {{1, 2, 3, 4}, {2, 6, 7, 3}, {3, 7, 8, 4}};
  6. \[Phi]s = {0, 1, 1, 0, 0, 1, 1, 0} Pi/4;
  7. r = 0.5;
  8. Manipulate[
  9. Graphics[
  10. {GraphicsComplex[
  11. Table[ps[[i]] +
  12. r {Sin[\[Phi]s[[i]] + t], Cos[\[Phi]s[[i]] + t]}, {i, 8}],
  13. {PointSize[Large], Point[Range[8]], Line[edges],
  14. FaceForm[Directive[Opacity[0.5], Red]], Polygon[faces[[1]]],
  15. FaceForm[Directive[Opacity[0.5], Blue]], Polygon[faces[[2]]],
  16. FaceForm[Directive[Opacity[0.5], Orange]], Polygon[faces[[3]]]}
  17. ],
  18. GraphicsComplex[ps,
  19. Table[{Circle[i, r]}, {i, Range[8]}]
  20. ]
  21. }
  22. , PlotRange -> {{-0.1 - r, 1.7 + r}, {-0.1 - r, 1.7 + r}}]
  23. , {t, 0, 2 Pi}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement