Message Boards Message Boards

GROUPS:

[GIF] Interstellar (A Closed Geodesic in 17-Gon Space)

Posted 3 years ago
1285 Views
|
0 Replies
|
6 Total Likes
|

A closed geodesic in 17-gon space

Interstellar

Another closed geodesic in polygon space, this time with 17-gons (see here, here, and here for more examples and background).

Here's the source code (following a suggestion of @Todd Rowland, I'm now using a single DynamicModule rather than two nested Modules):

ToReal[z_] := {Re[z], Im[z]};
ToComplex[{x_, y_}] := x + I y;
FrameToEdges[frame_] := ToReal[ToComplex[#]^2] & /@ Transpose[frame];
FrameToVertices[frame_] := Accumulate[FrameToEdges[frame]];
DualFourFrame[frame_] := Orthogonalize[NullSpace[frame]];

DynamicModule[{n, a, b, cols, θ, fr, dfr, verts},
 n = 17;
 a = 9;
 b = 3;
 cols = RGBColor /@ {"#FF7844", "#23425F"};
 Manipulate[
  θ = π/2 (1/2 - 1/2 Cos[π (s - Floor[s])] + Floor[s]);
   fr = Transpose[
    ToReal[Sqrt[#]] & /@ 
     Table[2/n E^(I θ), {θ, π (b - 1)/n, 
       2 π b + π (b - 1)/n - 2 π b/n, 2 π b/n}]];
  dfr = Transpose[
    ToReal[Sqrt[#]] & /@ 
     Table[2/n E^(I θ), {θ, π (a - 1)/n, 
       2 π a + π (a - 1)/n - 2 π a/n, 2 π a/n}]];
  Graphics[{FaceForm[None], 
    EdgeForm[
     Directive[JoinForm["Round"], cols[[1]], Thickness[.0045]]], {
     verts = FrameToVertices[Cos[θ] fr + Sin[θ] dfr];
     Polygon[-Mean[verts] + # & /@ verts]}}, ImageSize -> 540, 
   PlotRange -> .3, Background -> cols[[2]]], {s, 0, -2}]]
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