Message Boards Message Boards


[GiF] Snowflake (Lattice Inversion)

Posted 5 years ago
2 Replies
8 Total Likes

Hello, Wolfram Community. My name is Mike Sollami, and I'm a data scientist based in Cambridge, MA. I'm primarily interested in the application of deep learning to computer vision, nlp, and time series. I really like making animated GIFs with Mathematica, so for the holidays I wanted to design something "snowflakey" for fun and ended up with this design, it's an animation of polyhedron inversion:

enter image description here

Here's the code:

mp[Polygon[points_]] := Apply[Plus, points]/Length[points];
mp[polys:{_Polygon..}]:=Apply[Plus, Map[mp,polys]]/Length[polys];
fmp[body_,face_Polygon]:=2 mp[face]-mp[body]
    If[Min[(# . #)&/@((u-#)&/@mpl)]>0.001,
       AppendTo[mpl,u]; r[body,#],{}]
    ][fmp[body,#]]]& /@ body
pc[n_]:=Block[{mpl={{0,0,0}}}, NestList[Flatten[rb /@ #,1]&,{p},n]]
skeleton[body_List]:= With[{pm = mp@body},Function[l, Function[mpp, 
       Partition[Append[l,First[l]],2,1],{1}]][mp[Polygon[l]]]] /@ Map[First,body]
Show[Graphics3D[bpc = Map[skeleton[#] &, pc[1], {2}]]]
g = Graphics3D[{EdgeForm[
     None], {Opacity[0.99], 
       Blend[{Blue, Hue[0.65 - 0.19 Norm[mp[#]]]}, 1/3], 
       Specularity[White, 10], #} & /@ Flatten[bpc]}, 
   Lighting -> Automatic, Boxed -> False, Background -> Black];

 With[{v = RotationTransform[i*\[Pi]/4, {0, 0, 1}][{-1, -1, 0}]}, 
  Show[g /. Polygon[l_] :> Polygon[l - i*(l - (#/# . # & /@ l))], 
   Boxed -> False, SphericalRegion -> True, ViewPoint -> v, 
   Background -> Black]], {i, 0, 2}, SynchronousUpdating -> False]
POSTED BY: Michael Sollami
2 Replies

Neat idea and execution! If you GIFs with math behind, you should take a look at works by @Clayton Shonkwiler. I'd love to see more of your GIFs ;-)

POSTED BY: Sam Carrettie

enter image description here - Congratulations! This post is now a Staff Pick as distinguished by a badge on your profile! Thank you, keep it coming!

POSTED BY: Moderation Team
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract