Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ps = {
- {True, {0, 0}, 0, 1}
- };
- n = 6;
- \[Phi] = N[
- 1/3 (27/2 - (3 Sqrt[69])/2)^(1/3) + (1/2 (9 + Sqrt[69]))^(1/3)/3^(
- 2/3)];
- split[p_] := Module[{centre, \[Theta], scale},
- {centre, \[Theta], scale} = p[[2 ;;]];
- {
- {True,
- centre -
- scale RotationMatrix[\[Theta]].{1/(2 \[Phi]^2), 0}, \[Theta] +
- Pi/2, scale/\[Phi]},
- {True,
- centre +
- scale RotationMatrix[\[Theta]].{1/(2 \[Phi]),
- 1/(2 \[Phi]^2)}, \[Theta], scale/(\[Phi]^3)},
- {False,
- centre +
- scale RotationMatrix[\[Theta]].{1/(2 \[Phi]), -1/(2 \[Phi]^3)}, \
- \[Theta] - Pi/2, scale/\[Phi]^2}
- }
- ];
- nextgen[ps_] := Flatten[Map[split,
- Select[ps, First]
- ], 1];
- allps = Flatten[NestList[nextgen, ps, n], 1];
- graphic[p_] := Module[{centre, \[Theta], scale, w, bl, tr},
- {centre, \[Theta], scale} = p[[2 ;;]];
- If[First[p],
- bl = centre - scale RotationMatrix[\[Theta]].{\[Phi], 1}/2;
- tr = centre + scale RotationMatrix[\[Theta]].{\[Phi], 1}/2;
- Rectangle[bl, tr],
- bl = centre - scale RotationMatrix[\[Theta]].{1, 1}/2;
- tr = centre + scale RotationMatrix[\[Theta]].{1, 1}/2;
- Rectangle[bl, tr]
- ]
- ];
- arcs[p_] := Function[{t},
- Module[{centre, \[Theta], scale, out = {}},
- {centre, \[Theta], scale} = p[[2 ;;]];
- out = {
- Thickness[Max[0.001, 0.01 Sqrt[scale]]],
- Circle[centre - scale RotationMatrix[\[Theta]].{0, 1},
- scale/Sqrt[2],
- {\[Theta] + Pi/4, \[Theta] +
- Pi/4 + (2 Pi/4 ) Max[0, Min[1, 2 t]]}],
- Circle[
- centre -
- scale RotationMatrix[\[Theta]].{1/\[Phi], 1/(2 \[Phi]^3)},
- scale/(2 \[Phi]), {\[Theta] - Pi/4 - 0.1, \[Theta] - Pi/4 -
- 0.1 + Max[0, Min[1, 2 (t - 0.5)]] (Pi/2 + 0.2)}]
- }
- ]
- ];
- squares = Select[allps, Not[First[#]] &];
- graphics = Map[graphic, allps];
- Manipulate[
- Graphics[{
- EdgeForm[Black], FaceForm[],
- If[t < Length@squares - 1,
- {graphics[[;; 1 + 3 Floor[t + 1]]],
- {EdgeForm[Opacity[Mod[t, 1]]],
- graphics[[
- Max[1, 2 + 3 (Floor[t + 1])] ;; Max[1 + 3 Floor[t + 2], 1]]]}}
- , {}],
- Table[
- {
- ColorData["DarkRainbow"][(i/(Length@squares - 1))^0.5],
- arcs[squares[[i]]][t - i + 1]
- }
- , {i, Length@squares}]
- }, PlotRange -> {{-\[Phi], \[Phi]}, {-1, 1}}/1.9]
- ,{t,0,Length@squares - 1}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement