MathGroup Archive 2008

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

Search the Archive

Re: Rotation about 3 principal axes

  • To: mathgroup at smc.vnet.net
  • Subject: [mg94223] Re: Rotation about 3 principal axes
  • From: dh <dh at metrohm.com>
  • Date: Mon, 8 Dec 2008 06:22:54 -0500 (EST)
  • References: <ghavrq$obo$1@smc.vnet.net>


Hi Robert,

rotation are a bit tricky. Your mistake lies in assuming that rotations 

can be applied in  any order. This is not true. It matters if you first 

apply Rx and then Ry or first  Ry and then Rx. Your code first aplies Rx 

and the Ry.

So lets assume a 90 degree rotation around y and the some rotation 

around x. The corresponding matrixes (for simplicity I am using 3D 

ccordinates, not homogeneous coordinates like RotationTransform does) are:

Rx={{1, 0, 0}, {0, Cos[a], Sin[a]}, {0, -Sin[a], Cos[a]}}

Ry={{0, 0, 1}, {0, 1, 0}, {-1, 0, 0}}

calculating Ry.Rx gives:

{{0, -Sin[a], Cos[a]}, {0, Cos[a], Sin[a]}, {-1, 0, 0}}

you see the z-component of the result (from {-1,0,0}) is now constant, 

that is we rotate by the angle a around the z-axis.

On the other hand, Rx.Ry gives:

{{0, 0, 1}, {-Sin[a], Cos[a], 0}, {-Cos[a], -Sin[a], 0}}

and you see that now the x component is not changed by the angle a, that 

is, we have a rotation around the x axis. And this is what you assumed 

in  first place!

hope this helps, Daniel



robert prince-wright wrote:

> 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: Run initialization cells before dynamic cells
  • Next by Date: Re: Clever Tricky Solutions
  • Previous by thread: Rotation about 3 principal axes
  • Next by thread: Re: Rotation about 3 principal axes