Rotate, translate, scale of 3D objects
Sándor Kabai
This is to show how 3D objects are to be rotated, translated and scaled.
In[]:=
Manipulate[Module[{cub,axisx,axisy,axisz,textx,texty,textz},​​cub=Translate[PolyhedronData["Cube","Faces"],{0.5,0.5,0.5}];​​axisx={Red,Thick,Line[{{-2,0,0},{2,0,0}}]};​​axisy={Green,Thick,Line[{{0,-2,0},{0,2.5,0}}]};​​axisz={Blue,Thick,Line[{{0,0,-2},{0,0,2}}]};​​textx=Text[axisx,{2,0,0}];​​texty=Text[axisy,{0,2.7,0}];​​textz=Text[axisz,{0,0,2.2}];​​Graphics3D[{Rotate[Rotate[Rotate[Translate[Scale[{cub},{scalex1.618,scaley,scalez0.618},{0,0,0}],{transx,transy,transz}],rotx,{1,0,0}],roty,{0,1,0}],rotz,{0,0,1}],axisx,axisy,axisz,textx,texty,textz},BoxedFalse,SphericalRegionTrue,PlotRange2.6,ViewAngle0.23]],​​{{scalex,1,"scale x"},0.618,1,ImageSizeTiny},​​{{scaley,1,"scale y"},1,1.5,ImageSizeTiny},​​{{scalez,1,"scale z"},1,1.5,ImageSizeTiny},​​Delimiter,​​{{transx,0,"translate x"},-0.5,0.5,ImageSizeTiny},​​{{transy,0,"translate y"},-0.5,0.5,ImageSizeTiny},​​{{transz,0,"translate z"},-0.5,0.5,ImageSizeTiny},​​Delimiter,​​{{rotx,0,"rotate x"},0,2Pi,ImageSizeTiny},​​{{roty,0,"rotate y"},0,2Pi,ImageSizeTiny},​​{{rotz,0,"rotate z"},0,2Pi,ImageSizeTiny},​​TrackedSymbols{rotx,roty,rotz,scalex,scaley,scalez,transx,transy,transz}]
Out[]=
​
scale x
scale y
scale z
translate x
translate y
translate z
rotate x
rotate y
rotate z