6
|
11867 Views
|
|
7 Total Likes
View groups...
Share
GROUPS:

# [GIF] Jumping cube completion

Posted 8 years ago

## Jumping cube completion

Recursively a small cube completes a bigger cube...

colors={RGBColor[0.91,0.25,0.1],RGBColor[0.25,0.71,0.1]}
nearcubeside={Polygon[{{3,0,0},{3,3,0},{3,3,2},{3,2,2},{3,2,3},{3,0,3}}],Polygon[{{2,2,2},{2,3,2},{2,3,3},{2,2,3}}]};
nearcube={nearcubeside,Rotate[nearcubeside,120\[Degree],{1,1,1}],Rotate[nearcubeside,240\[Degree],{1,1,1}]};
cube=Cuboid[-0.5{1,1,1},0.5{1,1,1}];
cube={Polygon[0.5{{1,-1,-1},{1,1,-1},{1,1,1},{1,-1,1}}],Polygon[0.5{{-1,-1,-1},{-1,1,-1},{-1,1,1},{-1,-1,1}}]};
cube={#,Rotate[#,120\[Degree],{1,1,1}],Rotate[#,240\[Degree],{1,1,1}]}&/@cube;
cube=Riffle[colors,cube];

position=8{1,1,1};

begin=position;
end=2.5{1,1,1};
delta=begin-end;
a=25;
c1=delta[[3]]-a/2;
f=Function[{t},begin-delta{1,1,0}t-{0,0,1}(c1 t + a t^2/2)];

\[Omega]=2\[Pi] 1.5 ;

ClearAll[MakeScene]
MakeScene[\[Tau]_]:=Module[{cubet,obj,pos,spin,camerapos},
If[\[Tau]<2/3,
cubet=1.5\[Tau];
pos=f[cubet];
spin=\[Omega] cubet;
obj={nearcube,Translate[Rotate[cube,spin,{1,-1,0}],pos]};
,
obj=Cuboid[{0,0,0},{3,3,3}];
];
camerapos={1,1,1}(10-2.5\[Tau]);
Graphics3D[{EdgeForm[],colors[[2]],obj},Axes->False,AxesOrigin->{0,0,0},Boxed->False,Lighting->"Neutral",ViewVector->{camerapos,-{1,1,1}},ImageSize->{400,400},ViewAngle->50*Degree,Background->RGBColor[0.05,0.35,0.77]]
]

Manipulate[MakeScene[\[Iota]],{\[Iota],0,1}]

Sort By:
Posted 8 years ago
 - another post of yours has been selected for the Staff Picks group, congratulations !We are happy to see you at the tops of the "Featured Contributor" board. Thank you for your wonderful contributions, and please keep them coming!
Community posts can be styled and formatted using the Markdown syntax.