Randomize Motion for Six Degrees of Freedom
Randomize Motion for Six Degrees of Freedom
Manipulate[SeedRandom[seed];{x,y,z,Rx,Ry,Rz}=If[random,iDot[DiagonalMatrix[RandomInteger[{1,0},{6}]],Join[RandomReal[(7/180){-1,1},{3}],RandomReal[.5{-1,1},{3}]]],{x,y,z,Rx,Ry,Rz}];Graphics3D[{If[n3,{},ground],If[co,coordinate,{}],EdgeForm[GrayLevel[.3]],Translate[Rotate[Rotate[Rotate[model[[n]],Rx°,{1,0,0}],Ry°,{0,1,0}],Rz°,{0,0,1}],{x,y,z}]},Axesco,Boxedbox,ImageSize{400,400},Lightingn/.{1Automatic,2None,3"Neutral"},PlotRange10.5,ViewPointview/.Thread[Rule[{"default","above","back","right","below","front","left"},points]]],{{n,3,"model"},{1"cuboid",2"ball",3"space shuttle"},ControlTypePopupMenu},Delimiter,{{view,"default","view"},{"default","above","back","right","below","front","left"},ControlTypePopupMenu},{{box,False,"boxed"},{True,False},ControlTypeCheckbox},{{co,False,"coordinate"},{True,False},ControlTypeCheckbox},Delimiter,"degree of freedom",{{x,0,"x"},-7,7,.1,ImageSizeSmall,Enabled!random},{{y,0,"y"},-7,7,.1,ImageSizeSmall,Enabled!random},{{z,0,"z"},-7,7,.1,ImageSizeSmall,Enabled!random},{{Rx,0,"Rx"},-180,180,1,ImageSizeSmall,Enabled!random},{{Ry,90,"Ry"},-180,180,1,ImageSizeSmall,Enabled!random},{{Rz,0,"Rz"},-180,180,1,ImageSizeSmall,Enabled!random},Delimiter,{{random,False,"randomize"},{True,False},ControlTypeCheckbox},{{seed,1,"seed"},1,1234,1,ImageSizeSmall},{{i,-180,"start"},-180,180,1,AnimationRepetitions2,ControlTypeTrigger},ControlPlacementLeft,TrackedSymbolsTrue,Initialization(ngons=Union[Flatten[Map[First,PolyhedronData["Archimedean","FaceCountRules"],{2}]]];colors={White,White,Black,White};ball=Normal[PolyhedronData["TruncatedIcosahedron","Faces"]]/.Polygon[x_]{Glow[colors[[Position[ngons,Length[x]][[1,1]]]]],Polygon[x]};spaceShuttle=Scale[ExampleData[{"Geometry3D","SpaceShuttle"},"GraphicsComplex"],.75];model={Cuboid[{-3,-2,-1},{3,2,1}],ball,spaceShuttle};ground={Opacity[.3],Green,Polygon[10{{-1,-1,-1},{-1,1,-1},{1,1,-1},{1,-1,-1}}]};coordinate={Text[Style[#〚1〛,Italic],#〚2〛]&/@Transpose[{{"x","y","z"},5IdentityMatrix[3]}],Red,Sphere[{0,0,0},.2],Gray,Arrowheads[.015],Arrow[{{0,0,0},#}]&/@(4IdentityMatrix[3])};points=Prepend[Flatten[Outer[Times,{1,-1},Permutations[{0,0,Infinity}]],1],{2,-2,1}];)]
Six degrees of freedom (6DoF) refers to six independent motions of a rigid body in 3D space. They consist of three translations along the , , and axes and three rotations around those axes, , , and . 6DoF is a fundamental concept for mechanical, aeronautical, and robotics engineering. This Demonstration lets you interactively control a model with 6DoF, or you can choose the randomize option to visualize motion with multiple DoF combinations. (Select the "randomize" checkbox to toggle between random and manual control mode. )
x
y
z
R
x
R
y
R
z