Posts tagged: C6

snowflake fractals

Mathematica code:

h[1] = Table[{Cos[n*Pi/3], Sin[n*Pi/3]}, {n, 0, 5, 1}];h[s_, k_] := Plus @@@ Tuples[Table[s^(n)*h[1], {n, 1, k}]]SnowFlakeFractal[s1_, s2_, N0_, N_, o_, S_, R_, pr_] := Graphics[  Rotate[   Scale[    {White, Opacity[o],     Table[      Rotate[       Translate[        Scale[         Table[Line[           {{0, 0}, h[1][[i]]}],          {i, 1, 6, 1}],         s1^(n - 1)],       h[s2, n]],       .5^n*Pi/3],      {n, N0, N, 1}]},    S],   R],  Background -> Black, PlotRange -> pr, ImageSize -> 500]Manipulate[ Show[Table[  SnowFlakeFractal[s1, s2, N0, N, o, S^F, R, pr],{F,1,6,1}]],{{s1, .28}, 1, 0}, {{s2, .38}, 1, 0}, {{N0, 4}, 0, 5, 1}, {{N, 5}, 0, 6, 1}, {o, 1, 0},  {{S, 1}, 2, 0}, {{R, 1}, 0, Pi/3}, {{pr, 1}, 6, .001}]V = {  {.28, .38, .25, .48, .14},  {.26, .4, .3, .4, .14},  {.35, .4, .35, .3, .1},  {.33, .34, .35, .28, .1}  }Table[Manipulate[Show[Table[SnowFlakeFractal[V[[i]][[1]],V[[i]][[2]],N0,N,o,V[[i]][[3]]^F,R,pr],{F,1,6,1}]],{pr, V[[i]][[4]]], V[[i]][[5]], -.02}],{i,1,4,1}]
Filed under: #GIF  #Mathematica  #snowflakes  #C6

Each snowflake is algorithmically generated using some randomness to create infinitely many snowflakes where no two are exactly alike.

Mathematica code:

rr[n_] := (SeedRandom[n]; RandomReal[])H = Table[{Cos[n*Pi/3], Sin[n*Pi/3]}, {n, 0, 5, 1}];SnowFlake[Q_, x_, y_, R_, S_, k_, h_, o_, s_, N_, PR_, IS_] :=  Graphics[{   Rotate[    Translate[     Scale[      Table[       Table[        Rotate[         Translate[          Scale[           Table[            {AbsoluteThickness[k*h^(n - 1)], Opacity[o], White,             Line[              {{0, 0}, H[[i]]}]},            {i, 1, 6, 1}],           s^(n - 1)],          {If[n == 1, 0, rr[Q*n]], 0}],         If[n == 1, 0, (j + rr[Q*n])*Pi/3], {0, 0}],        {j, 0, 5, 1}],       {n, 1, N, 1}],      S],     {x, y}],    R, {x, y}]},  PlotRange -> PR, ImageSize -> IS, Background -> Black]Manipulate[ SnowFlake[Q, 0, 0, rr[2 Q] Pi/3, 1, k, h, o, s, N, 2, 500], {Q, 1, 1000, 1}, {{k, 1}, 0, 2}, {{h, .9}, 1, 0}, {{o, .75}, 1, 0}, {{s, .75}, 1, 0}, {{N, 10}, 1, 20, 1}]Manipulate[GraphicsGrid[   Table[    SnowFlake[Q*W, 0, 0, (-1)^(Round[rr[4 Q*W]]) (t + rr[2 Q*W]) Pi/3,              1, 1, .85, .8, .5 + .2 rr[3 Q*W], 15, 2, 100],   {Q, q, q+6, 1}, {W, w, w+4, 1}], Background -> Black, ImageSize -> {500, 700}, AspectRatio->7/5],{q, 1, 100, 1}, {w, 1, 100, 1}, {t, 0, 1 - 1/25, 1/25}]