MathGroup Archive 2008

[Date Index] [Thread Index] [Author Index]

Search the Archive

Rotation about 3 principal axes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94110] Rotation about 3 principal axes
  • From: robert prince-wright <robertprincewright at yahoo.com>
  • Date: Fri, 5 Dec 2008 05:30:12 -0500 (EST)

Can someone help me change the code below.

The  manipulate is meant to represent the effect of rotating a local coordinate set about angles 'ax', 'ay', 'az', these angles should be rotations about the global coordinates. If you use the sliders independently (i.e. with the other two angles set to zero) then it behaves as expected. However, if you change angle 'ay' to 90 (blue line downwards) and then slide 'ax' then the local coordinates rotate about the global z and not the desired global x. Somehow it is not using the rotation vectors inside the RotationTransform[ ]. I have tried various combinations including the use of Rotate[g,w,p], but the same think keeps happening. 

 

Manipulate[
 LCposition = N[{0, 0, 0}];
 xLocal := Line[{LCposition, LCposition + {1 , 0., 0.}}];
 yLocal := Line[{LCposition, LCposition + {0., 1 , 0.}}];
 zLocal := Line[{LCposition, LCposition + {0., 0., 1 }}];
 lc = {Thick, Blue, xLocal, Green, yLocal, Red, zLocal};
 
 Rx := RotationTransform[ ax Degree, {1, 0, 0}, {0, 0, 0}];
 Ry := RotationTransform[ ay Degree, {0, 1, 0}, {0, 0, 0}];
 Rz := RotationTransform[ az Degree, {0, 0, 1}, {0, 0, 0}];
 
 gx := GeometricTransformation[lc, Rx];
 gy := GeometricTransformation[gx, Ry];
 gz := GeometricTransformation[gy, Rz];
 
 Graphics3D[gz, PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}],
 {{ax, 0}, -360, 360, 1, Appearance -> "Labeled"},
 {{ay, 0}, -360, 360, 1, Appearance -> "Labeled"},
 {{az, 0}, -360, 360, 1, Appearance -> "Labeled"}
]


  • Prev by Date: Re: Mathematica 7 is now available
  • Next by Date: Re: Plotting Vector Fields in Mathematica 7
  • Previous by thread: Re: Re: Re: easier method for
  • Next by thread: Re: Rotation about 3 principal axes