Message Boards Message Boards


[GIF] How Does That Work? (Hamiltonian cycle on the 5-cell)

Posted 1 year ago
1 Reply
4 Total Likes

Hamiltonian cycle on the 5-cell

How Does That Work?

Very much the same idea as Touch ’Em All and All Day: think of the vertices of the 5-cell as living in the 3-sphere, put congruent spheres at each vertex, move them along a Hamiltonian cycle on the 1-skeleton of the 5-cell, then stereographically project the whole picture to $\mathbb{R}^3$.

I really like how this specific perspective creates a bit of a visual illusion.

Here's the code (once again leaving out the definition of ProjectedSphere[], which can be found here):

Stereo[{x1_, y1_, x2_, y2_}] := {x1/(1 - y2), y1/(1 - y2), x2/(1 - y2)}

smootheststep[t_] := -20 t^7 + 70 t^6 - 84 t^5 + 35 t^4;

fivecellvertices = 
  Normalize /@
   {{1/Sqrt[10], 1/Sqrt[6], 1/Sqrt[3], 1},
    {1/Sqrt[10], 1/Sqrt[6], 1/Sqrt[3], -1},
    {1/Sqrt[10], 1/Sqrt[6], -2/Sqrt[3], 0},
    {1/Sqrt[10], -Sqrt[3/2], 0, 0},
    {-2 Sqrt[2/5], 0, 0, 0}};

 {θ, pts = N[fivecellvertices], angle, pts3d, v, b, 
  cols = RGBColor /@ {"#F23557", "#22B2DA", "#3B4A6B"}},
 angle = VectorAngle @@ pts[[;; 2]];
 pts3d = Stereo /@ pts;
 v = Normalize[pts3d[[2]] - pts3d[[1]]];
 b = Normalize[NullSpace[{v, pts3d[[-1]]}][[1]]];
  θ = smootheststep[1 - t];
   {Specularity[.8, 50],
     ProjectedSphere[RotationMatrix[angle*θ, {pts[[i]], pts[[Mod[i + 1, Length[pts], 1]]]}].pts[[i]], .15],
     {i, 1, Length[pts]}]},
   Boxed -> False, PlotRange -> 3, ViewPoint -> v, 
   ViewVertical -> -pts3d[[-1]], ViewAngle -> π/5, 
   Background -> Darker[cols[[-1]]], ImageSize -> 540, 
   Lighting -> {{"Directional", cols[[1]], RotationMatrix[2 π θ, v].(b - v/2)},
     {"Directional", cols[[2]], -RotationMatrix[2 π θ, v].(b + v/2)},
     {"Ambient", Darker[cols[[-1]]]}}],
  {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!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract