Rotation Matrix

Author

Eric W. Weisstein
November 3, 2004

This notebook downloaded from http://mathworld.wolfram.com/notebooks/LinearAlgebra/RotationMatrix.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/RotationMatrix.html.

©2005 Wolfram Research, Inc. except for portions noted otherwise

Code

movie[r_,opts___]:=Table[Graphics3D[{
Polyhedron[Cube]/.Polygon[x_]:>Polygon[r[a].#&/@x],
{Red,Thickness[.02],Line[{{0,0,0},#}]&/@IdentityMatrix[3]},
Text[#1,1.1#2,TextStyle->{FontFamily->"Times",FontSlant->"Italic"}]&@@@Transpose[{{"x","y","z"},IdentityMatrix[3]}]
},opts,ViewPoint->{1,1,1},Boxed->False,PlotRange->{{-.7,1},{-.7,1},{-.7,1}}],{a,0,Pi/2-Pi/2/10,Pi/2/10}]

Vector Rotation

<<Graphics`Arrow`

m[θ_]:={{Cos[θ],-Sin[θ]},{Sin[θ],Cos[θ]}}

Show[Graphics[{
Arrow[{0,0},{1,0}],
Arrow[{0,0},{0,1}],
{Red,Arrow[{0,0},m[.4].{.9,0}]},
{Red,Dashing[{.05}],Arrow[{0,0},{.9,0}]},
{Blue,
Arrow[{.232,.075},{.225,.095}],
Text[TraditionalForm[θ],{.3,.05},TextStyle->{FontSize->14}],
Circle[{0,0},.25,{0,.4}]
},
{Red,
Text["v'",{.9,.36},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}],
Text["(Subscript[v, 0])",{.85,.08},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}]
},
Text["(OverHat[x])",{1.05,.0},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}],
Text["(OverHat[y])",{0,1.05},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}]
}
],AspectRatio->Automatic,PlotRange->All]

Coordinate System

mp[θ_]:={{Cos[θ],Sin[θ]},{-Sin[θ],Cos[θ]}}

Show[Graphics[{
Arrow[{0,0},m[.4].{1,0}],
Arrow[{0,0},m[.4].{0,1}],
{Red,Arrow[{0,0},{.9,0}]},
{Blue,
Arrow[{.232,.075},{.225,.095}],
Text[TraditionalForm[θ],{.3,.05},TextStyle->{FontSize->14}],
Circle[{0,0},.25,{0,.4}]
},
{Red,
Text["v",{.85,.08},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}]
},
{Dashing[{.05}],
Arrow[{0,0},{1,0}],
Arrow[{0,0},{0,1}]
},
Text["(Subscript[(OverHat[x]), 0])",{1.05,.0},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}],
Text["(Subscript[(OverHat[y]), 0])",{0,1.05},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}],
Text["(OverHat[x])'",m[.4].{1.05,.0},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}],
Text["(OverHat[y])'",m[.4].{0,1.05},TextStyle->{FontSize->14,"FontFamily"->"Times",FontWeight->"Bold"}]
}
],AspectRatio->Automatic,PlotRange->All]

x-axis

RotationMatrixX[α]//TraditionalForm

Show[#,ImageSize->150]&/@(xmovie=movie[RotationMatrixX])

Show[GraphicsArray[Take[xmovie,{1,10,3}]],ImageSize->400]

y-axis

RotationMatrixY[β]//TraditionalForm

Show[#,ImageSize->150]&/@(ymovie=movie[RotationMatrixY])

Show[GraphicsArray[Take[ymovie,{1,10,3}]],ImageSize->400]

z-axis

RotationMatrixZ[γ]//MatrixForm

Show[#,ImageSize->150]&/@(zmovie=movie[RotationMatrixZ])

Show[GraphicsArray[Take[zmovie,{1,10,3}]],ImageSize->400]

Animation

<<Utilities`GIF`;

Timing[Export[gifs<>"rotmat"<>#1<>".gif",#2,ImageSize->150]]&@@@{{"x",xmovie},{"y",ymovie},{"z",zmovie}}