Cube pyramids on cube
Sándor Kabai
Pyramids of cubes or rhombic dodecahedron (RD) or small rhombicuboctahedron (SRC) are placed on a cube. The contour is an octahedron. Cube, RD and SRC can be truncated to produce cuboctahedron and special SRC.
In[]:=
Needs["PolyhedronOperations`"];​​Manipulate[​​rd=PolyhedronData["RhombicDodecahedron","Faces"];​​rdn=Truncate[Scale[Rotate[rd,ArcTan[Sqrt[2]],{1,0,0}],Sqrt[3/2]],trrd];​​cub=PolyhedronData["Cube","Faces"];​​cubn=Truncate[Scale[Rotate[Rotate[cub,Pi/4,{0,0,1}],ArcTan[Sqrt[2]],{1,0,0}],Sqrt[2]],trcub];​​src=PolyhedronData["SmallRhombicuboctahedron","Faces"];​​srcn=Truncate[Scale[Rotate[Rotate[src,Pi/4,{0,0,1}],ArcTan[Sqrt[2]],{1,0,0}],0.83],trsrc];​​p=Table[{2j-i,Sqrt[3]i,0},{i,0,n},{j,i,n}];​​(*Cubecanbereplacedherewithrhombicdodecahedronorsmallrombicubocthedron*)​​(*cubn=rdn;orcubn=srcnorcubn=srcn;*);​​tri1=Map[Translate[cubn,#]&,p];​​tri2=Rotate[tri1,-Pi/6,{0,0,1}];​​pyr=Table[{Rotate[Rotate[tri2,-ArcTan[Sqrt[2]]-Pi,{0,1,0}],i2Pi/4+Pi/4,{0,0,1}]},{i,4}];​​cubc=Scale[cub,u(2n-1)+2u];​​u=Sqrt[2];​​p1=Translate[pyr,{0,0,(2u(n+2)/2+(n-1)u)}];​​p2=Table[{Hue[0.34^2i],Rotate[Rotate[p1,Pi/2,{1,0,0}],i2Pi/4,{0,0,1}]},{i,4}];​​p3=Rotate[p1,Pi,{1,0,0}];​​Graphics3D[{p1,p2,p3,RGBColor[0.8,0.7,1],cubc},BoxedFalse,SphericalRegionTrue,ImageSize400],​​{{n,3,"Frequency"},1,10,1,RadioButton},​​{{trcub,0,"Truncate cube"},0,0.5},​​{{trrd,0,"Truncate RD"},0,0.5},​​{{trsrc,0,"Truncate SRC"},0,0.5},​​TrackedSymbols{n,trrd,trcub,trsrc},ControlPlacement->Top]