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:
Here's the code:
p=PolyhedronData["TruncatedCuboctahedron","Faces","Polygon"][[1]]//N;
mp[Polygon[points_]] := Apply[Plus, points]/Length[points];
mp[polys:{_Polygon..}]:=Apply[Plus, Map[mp,polys]]/Length[polys];
r[body_,face_Polygon]:=With[{u=mp@face},Map[2u-#&,body,{-2}]];
fmp[body_,face_Polygon]:=2 mp[face]-mp[body]
rb[body_]:=Flatten[Function[u,
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,
Apply[Polygon[{mpp+0.8(#1-mpp),pm+0.8(#1-pm),pm+0.9(#2-pm),mpp+0.9(#2-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];
Manipulate[
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]