kellegous.com

Snowflake

I submitted the following to the Simplicity Snowflake-A-Thon 2005, which challenged competitors to create a simple program that generated the most beautiful snowflake. My goal was to keep the code short and still come out with something that looked pretty nice. The program is written in Mathematica and outputs a pdf document. More snowflakes, including the winning entries, can be seen at the Snowflake-A-Thon 2005 Gallery.

image of snowflake produced by the program (* kelly norton 2005 * math: simple, doesn't blow. *)

<<Graphics`ParametricPlot3D`
<<Graphics`Shapes`
fa[v_] := ParametricPlot3D[{
   x Sin[x/5] (v + Sin[y + x]),
   x Cos[x/5] (v + Sin[y + x]),
   x Cos[y+ x], EdgeForm[]}, {x,0,2Pi}, {y,0,2Pi}];

fb[v_] := ParametricPlot3D[{
   x Cos[x/5] (v + Cos[y + x]),
   x Sin[x/5] (v + Cos[y + x]),
   x Sin[y + x ], EdgeForm[]}, {x, 0, 2Pi}, {y, 0, 2Pi}];

e = Show[{ fa[30], fb[30], fa[60], fb[60]}];
Show[{
   e,
   RotateShape[e,0,0,Pi],
   RotateShape[e,0,0,Pi/3],
   RotateShape[e,0,0,2 Pi/3],
   RotateShape[e,0,0,-Pi/3],
   RotateShape[e,0,0,-2 Pi/3]},
   LightSources-> {
      {{ 100, 0, 100},RGBColor[0.20, 0.40, 0.80]},
      {{ 100, 100, 100},RGBColor[1.00, 0.60, 0.00]},
      {{-100,-100, 100},RGBColor[0.30, 1.00, 1.00]}},
   ViewPoint->{1,0,.6},Boxed->False,Axes->False];

Export[“005.pdf”,%,“PDF”];

B Sides