[GIF] Flap (Deformations of the Cairo tiling)

Posted 3 years ago
4831 Views
|
2 Replies
|
9 Total Likes
| FlapI was trying to recreate the Cairo pentagonal tiling and for whatever reason I ended up building it out of two-pentagon pieces connected along the short edge. That visually suggested some sort of butterfly, which naturally led me to making the "butterflies" flap their wings, and here we are.Here's the code: DynamicModule[{t = π/6., s, cols}, cols = RGBColor /@ {"#FF2E63", "#08D9D6", "#252A34"}; Manipulate[ Graphics[{FaceForm[None], EdgeForm[Thickness[.005]], Table[s = π/3. Haversine[ Clip[2 r - 2 π (x + 7)/14, {0, 2 π}]]; {EdgeForm[ Blend[cols[[;; 2]], 3 s/π]], Polygon[FoldList[ Plus, {Sqrt x Cos[t] - (2 Sqrt y + Sqrt HeavisideTheta[(-1)^x]) Sin[t], Cos[t] (2 Sqrt y + Sqrt HeavisideTheta[(-1)^x]) + Sqrt x Sin[t]}, Table[{Cos[t] Cos[θ] - i Cos[i s] Sin[t] Sin[θ], Cos[θ] Sin[t] + i Cos[i s] Cos[t] Sin[θ]}, {θ, Accumulate[{π/3, π/2, π/3, π/ 2}]}]]]}, {x, -7, 7}, {y, -4, 3}, {i, {-1, 1}}], Table[s = π/3. Haversine[ Clip[2 r - 2 π (x + 7)/14, {0, 2 π}]]; {EdgeForm[ Blend[cols[[;; 2]], 3 s/π]], Polygon[FoldList[ Plus, {Cos[ t] (1/2 (1 - 3 Sqrt) + 2 Sqrt y + Sqrt HeavisideTheta[(-1)^x]) - (1/2 (-1 + Sqrt) + Sqrt x) Sin[t], (1/2 (-1 + Sqrt) + Sqrt x) Cos[ t] + (1/2 (1 - 3 Sqrt) + 2 Sqrt y + Sqrt HeavisideTheta[(-1)^x]) Sin[t]}, Table[{-Cos[θ] Sin[t] + i Cos[i s] Cos[t] Sin[θ], Cos[t] Cos[θ] + i Cos[i s] Sin[t] Sin[θ]}, {θ, Accumulate[{π/3, π/2, π/3, π/ 2}]}]]]}, {x, -8, 8}, {y, -3, 4}, {i, {-1, 1}}]}, PlotRange -> 10, ImageSize -> 540, Background -> cols[]], {r, 0, 2 π}]] Now, that code is rather inscrutable-looking, in part because it cut down computation time to expand out various multiplications by RotationMatrix[t]; here's the original code, which is somewhat easier to read but slower: DynamicModule[{t = π/6., s, cols}, cols = RGBColor /@ {"#FF2E63", "#08D9D6", "#252A34"}; Manipulate[ Graphics[{FaceForm[None], EdgeForm[Thickness[.005]], Table[s = π/3. Haversine[ Clip[2 r - 2 π (x + 7)/14, {0, 2 π}]]; {EdgeForm[ Blend[cols[[;; 2]], 3 s/π]], Polygon[FoldList[Plus, RotationMatrix[t].{Sqrt x, 2 Sqrt y + Sqrt HeavisideTheta[(-1)^x]}, Table[RotationMatrix[t].{Cos[θ], i Cos[i s] Sin[ θ]}, {θ, Accumulate[{π/3, π/2, π/3, π/ 2}]}]]]}, {x, -7, 7}, {y, -4, 3}, {i, {-1, 1}}], Table[s = π/3. Haversine[ Clip[2 r - 2 π (x + 7)/14, {0, 2 π}]]; {EdgeForm[ Blend[cols[[;; 2]], 3 s/π]], Polygon[FoldList[Plus, RotationMatrix[ t].{2 Sqrt y + Sqrt HeavisideTheta[(-1)^x] - (3 Sqrt - 1)/2, Sqrt x + (Sqrt - 1)/2}, Table[RotationMatrix[t].{ i Cos[i s] Sin[ θ], Cos[θ]}, {θ, Accumulate[{π/3, π/2, π/3, π/ 2}]}]]]}, {x, -8, 8}, {y, -3, 4}, {i, {-1, 1}}]}, PlotRange -> 10, ImageSize -> 540, Background -> cols[]], {r, 0, 2 π}]] Answer
2 Replies
Sort By:
Posted 3 years ago
 Very beautiful! Like a carpet of butterflies. I know @Ed Pegg would appreciate this as he enjoys tilings. I am curious if some nice animations of Penrose tiling are possible. Answer
Posted 3 years ago - another post of yours has been selected for the Staff Picks group, congratulations !We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming! Answer