Message Boards Message Boards

[GIF] Five Easy Pieces (Rotating truncation of the tetrahedron)

Rotating truncation of the tetrahedron

Five Easy Pieces

Practically the same idea (and code) as Give Me Some Space, just truncating the tetrahedron rather than rectifying it.

The code for the Manipulate is below; when exporting to a GIF I used "DisplayDurations" -> Prepend[Table[1/50, {199}], 1/2] inside Export to get the animation to pause on the original tetrahedron for half a second.

DynamicModule[{viewpoint = {Cos[2?/3], Sin[2?/3], 1/Sqrt[2]},
  g = .6, d = .2, n = 4,
  v = PolyhedronData["Tetrahedron", "VertexCoordinates"],
  e = {{2, 3, 4}, {1, 4, 3}, {4, 1, 2}, {3, 2, 1}},
  tt = PolyhedronData["TruncatedTetrahedron", "VertexCoordinates"],
  te = PolyhedronData["TruncatedTetrahedron", "Faces"][[2]],
  cols = RGBColor /@ {"#e43a19", "#f2f4f7", "#111f4d"},
  s, r},
 Manipulate[
  s = Haversine[? t];
  r = Haversine[2 ? t];
  Graphics3D[{Thickness[.004], EdgeForm[None],
    Table[
     {GraphicsComplex[
       (1/2 + r/2) v[[i]] + RotationTransform[2 ?/3 s, v[[i]]][#] & /@ (v/4),
       {cols[[1]], Polygon[e[[i]]], cols[[2]], Polygon[e[[Drop[Range[4], {i}]]]]}]},
     {i, 1, Length[v]}],
    GraphicsComplex[
     RotationTransform[0, {0, 0, 1}][RotationTransform[? s, {-Sqrt[3], -3, Sqrt[6]}][1/4 tt]],
     {cols[[1]], Polygon[te[[1, ;; 4]]], cols[[2]], Polygon[te[[1, 5 ;;]]]}]},
   Boxed -> False, ImageSize -> {540, 540}, PlotRange -> 2.5, 
   Background -> cols[[-1]], ViewPoint -> 10 viewpoint, 
   ViewAngle -> ?/125, ViewVertical -> {0, 0, 1}, 
   SphericalRegion -> True,
   Lighting -> {{"Ambient", GrayLevel[d]},
     {"Directional", GrayLevel[g], ImageScaled[{2, 0, 2}]},
     {"Directional", GrayLevel[g], ImageScaled[{-2, 2, 2}]},
     {"Directional", GrayLevel[g], ImageScaled[{0, -2, 2}]}}],
  {t, 0, 1}]
 ]

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract