Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OrderedDivisors[1] = {1};
- OrderedDivisors[n_] := Flatten[Table[
- Map[Flatten@Join[{m}, #] &, OrderedDivisors[n/m]]
- , {m, Divisors[n][[2 ;;]]}], 1];
- \[Gamma] = 0.5;
- FactorPs[{}, p_, s_, \[Theta]_] := p;
- FactorPs[divisors_, p_, s_, \[Theta]_] := Partition[Flatten[
- With[{n = divisors[[1]]},
- Table[
- FactorPs[
- divisors[[2 ;;]],
- p +
- s {Sin[ 2.0 Pi i / n + \[Theta]], Cos[2.0 Pi i /n + \[Theta]]},
- s \[Gamma] / Sqrt[n],
- \[Theta] + 2.0 Pi i /n
- ]
- , {i, n}]]], 2];
- FactorPs[divisors_] := FactorPs[divisors, {0, 0}, 1];
- FormatDivisors[divisors_] :=
- StringJoin[Riffle[ToString /@ divisors, " \[Cross] "]];
- m = 12;
- os = Reverse@OrderedDivisors[m];
- ps = Map[FactorPs, ods];
- colours = Table[ColorData["DarkRainbow"][i/m], {i, m}];
- Manipulate[
- Graphics[
- With[{\[Tau] = Mod[t, 1, 0]},
- {
- {
- PointSize[Medium],
- With[{pst = (1 - \[Tau]) ps[[Floor[t]]] + \[Tau] ps[[
- Min[Length@ps, Floor[t] + 1]]]},
- Table[
- {colours[[i]], Point[pst[[i]]]}, {i, m}]
- ]
- },
- {GrayLevel[0.1], Opacity[1 - \[Tau]^0.5],
- Text[Style[FormatDivisors[ods[[Floor[t]]]], FontSize -> 20,
- FontFamily -> "Arial"], {0, 0}], Opacity[\[Tau]^4],
- Text[Style[FormatDivisors[ods[[Min[Length@ps, Floor[t] + 1]]]],
- FontSize -> 20, FontFamily -> "Arial"], {0, 0}]}
- }
- ]
- , PlotRange -> 2],
- {t, 1, Length@ps}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement