Advertisement
Guest User

Untitled

a guest
Aug 1st, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. penPts = {Cos[#], Sin[#]} & /@ Range[0, 2 Pi, 2 Pi/5][[1 ;; -2]];
  2.  
  3. tau = (2 Sqrt[5])/(5 + Sqrt[5]);
  4.  
  5. Graphics[{Blue, Polygon[penPts], Red, PointSize [0.03],
  6. Point[penPts[[2]]*tau + penPts[[5]]*(1 - tau)], Green,
  7. Line[penPts[[{1, 3}]]], Line[penPts[[{2, 5}]]]}]
  8.  
  9. pentagram[pts_] :=
  10. Riffle[pts, #] &@(pts[[# + 1]]*tau + (1 - tau)*
  11. pts[[1 + Mod[# + 2, 5]]] & /@ Range[0, 4, 1]);
  12.  
  13.  
  14. Graphics[{Red, PointSize [0.03], Point[pentagram[penPts]], Green,
  15. Opacity[0.5], Polygon[pentagram[penPts]]}]
  16.  
  17. ind = PolyhedronData["Dodecahedron", "FaceIndices"];
  18. vert = PolyhedronData["Dodecahedron", "VertexCoordinates"];
  19. Graphics3D[ Polygon /@ pentagram /@ (vert[[#]] & /@ ind)]
  20.  
  21. Graphics3D[Polygon /@ Reverse@*pentagram /@ (vert[[#]] & /@ ind)]
  22.  
  23. MeshCells[
  24. DiscretizeGraphics@ Graphics3D@ Polygon@ pentagram@ vert[[First[ind]]], 2]
  25. (*
  26. {Polygon[{1, 9, 10}], Polygon[{3, 1, 2}], Polygon[{4, 1, 3}], Polygon[{5, 1, 4}],
  27. Polygon[{6, 1, 5}], Polygon[{7, 1, 6}], Polygon[{8, 1, 7}], Polygon[{9, 1, 8}]}
  28. *)
  29.  
  30. Graphics3D[{Polygon[#],
  31. MapIndexed[Text[Style[#2, "Label", Bold, 16], #1] &, #]} &@
  32. RotateLeft@pentagram@vert[[First[ind]]]
  33. ]
  34.  
  35. DiscretizeGraphics@ Graphics3D@ Polygon@ pentagram@ vert[[First[ind]]]
  36. DiscretizeGraphics@ Graphics3D@ Polygon@ Reverse@ pentagram@ vert[[First[ind]]]
  37.  
  38. Graphics3D[{Polygon[#],
  39. MapIndexed[Text[Style[#2, "Label", Bold, 16], #1] &, #]} &@
  40. RotateLeft@ pentagram@ vert[[First[ind]]]
  41. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement