Re: Convert axis and angle of rotation to rotations about X & Y axis'



Just d' FAQs wrote:
> On 14 Dec 2005 06:45:11 -0800, ericgorr@xxxxxxxxx wrote:
> >I am only concerned about aim, roll about the aim direction is not
> >important for my situation.
> >
> >Here's a (probably inefficient) possible solution:
> >
> >I'll work with the 3D coordinate system as pictured here:
> >http://mathworld.wolfram.com/SphericalCoordinates.html
> >
> >I can define a bounding sphere around my object, centered around (0, 0,
> >0).
> >
> >
> >a. Convert the axis-angle to a rotation matrix
> > (the OpenGL function glRotatef will be useful here)
> >
> >b. Take the XYZ point (0, 1, 0 ) and apply the rotation matrix to it.
> > Call this new point P.
> >
> >c. Determine the position of P in Spherical Coordinates.
> >
> >I now have an angle of rotation about the X-Axis (Phi) and an angl of
> >rotation about the Z-Axis (Theta) and essentially my answer.
>
> Fine. It appears you want to aim the Y axis using rotations around X
> and Z. Steps (a) and (b) are a reasonable way to start. Now you must
> decide two things: (1) Do you want to rotate first around X, or around
> Z?

Well, I want it to not matter, but clearly it does.

> (2) Do you want use (fixed) world axes or (rotating) body axes?

Fixed world axes.

I generally find it helps to see how things work themselves out when
using actual numbers and to make sure I understand the details, so I
will add some comments doing just that. Let's set theta 30 degrees and
phi to 60 degrees.


> Assume X first, world axes. Then we have the following
>
> P = [rotate by Theta around Z] [rotate by Phi around X] Y

Using the rotation matricies found at:
http://en.wikipedia.org/wiki/3D_projection

This formula then becomes:

P = [ cos(30) -sin(30) 0 0] [1 0 0 0] [0]
[ sin(30) cos(30) 0 0] [0 cos(60) -sin(60) 0] [1]
[ 0 0 1 0] [0 sin(60) cos(60) 0] [0]
[ 0 0 0 1] [0 0 0 1] [1]

P = [ cos(30) -sin(30)*cos(60) -sin(30)*-sin(60) 0][0]
[ sin(30) cos(30)*cos(60) cos(60)*-sin(60) 0][1]
[ 0 sin(60) cos(60) 0][0]
[ 0 0 0 1][1]

P = [ -sin(30)*cos(60) ] [ -0.25 ]
[ cos(30)*cos(60) ] ~= [ 0.433 ]
[ sin(60) ] [ 0.866 ]
[ 1 ] [ 1.0 ]


> Reverse this to read
>
> Y = [unrotate by Phi around X] [unrotate by Theta around Z] P

Y = [1 0 0 0][cos(-30) -sin(-30) 0 0] [-sin(30)*cos(60)]

[0 cos(-60) -sin(-60) 0][sin(-30) cos(-30) 0 0] [ cos(30)*cos(60)]
[0 sin(-60) cos(-60) 0][ 0 0 1 0] [ sin(60)]
[0 0 0 1][ 0 0 0 1] [ 1]

Y ~= [ cos(-30) -sin(-30) 0 0][ -0.25 ]
[cos(-60)*sin(-30) cos(-60)* cos(-30) -sin(-60) 0][ 0.433 ]
[sin(-60)*sin(-30) sin(-60)* cos(-30) cos(-60) 0][ 0.866 ]
[ 0 0 0 1][ 1.0 ]

Y ~= [ cos(-30)*-.25+ -sin(-30)*0.433 ]
[cos(-60)*sin(-30)*-.25+cos(-60)* cos(-30)*0.433+-sin(-60)*0.866]
[sin(-60)*sin(-30)*-.25+sin(-60)* cos(-30)*0.433+ cos(-60)*0.866]
[ 1 ]

Y = [0]
[1]
[0]
[1]

So far, so good.

> Let the components of P be (x,y,z). Let ct and st be cosine and sine
> of Theta; cp and sp, of Phi. Then we require unrotation by Theta to
> zero the x component of P:
>
> [0] [ ct st] [x]
> [r] = [-st ct] [y]

You lost me here. I am uncertain how you derived this.

> This is accomplish by letting r = sqrt(x^2+y^2), (ct,st) = (y,-x)/r,
> if r is non-zero, else by (ct,st) = (1,0).

Quickly,

r = sqrt(x^2+y^2)

I am interpreting this as the length of the vector P when projected
onto the XY plane. Is this the correct interpretation?

Assuming the above, I work it out to be:

[0] = [ x * cos(t) + y * sin(t) ]
[r] [ y * cos(t) - x * sin(t) ]

How did you get from here to:

r = sqrt(x^2+y^2),
(ct,st) = (y,-x)/r, (Is this written correctly?)
if r is non-zero, else by (ct,st) = (1,0).


> Similarly we require unrotation by Phi to zero the z component of P:
>
> [1] [ cp sp] [r]
> [0] = [-sp cp] [z]
>
> Notice the y component is already unrotated to be r. Also notice that
> r^2+z^2 should equal 1. So we take (cp,sp) = (r,z).

Same as above.

> The actual angles Phi and Theta are computed using a two-argument
> arctangent function.

I am uncertain how to get to this point.

.



Relevant Pages

  • Re: Convert axis and angle of rotation to rotations about X & Y axis
    ... >I'll work with the 3D coordinate system as pictured here: ... Convert the axis-angle to a rotation matrix ... >rotation about the Z-Axis (Theta) and essentially my answer. ... of Phi. ...
    (comp.graphics.algorithms)
  • Re: Huge bug when vectorizing
    ... history of motion, containing, say, N values of Euler angles psi, theta, ... A = matrix(psi, theta, phi) ... If you want to apply the kth rotation to the result of rotating v by the ...
    (comp.soft-sys.matlab)
  • Re: Newbie looking for info on basic graphics with Delphi.
    ... The wireframe itself is of course three-dimensional; for rendering ... \y/ over an angle phi is done by ... Even knowing *why* it can't really do anything else than rotate ... since rotation is about the model's origin, ...
    (comp.lang.pascal.delphi.misc)
  • Re: Einsteins Relativity Disregards the Doppler Effect?
    ... what is phi (did you mean that symbol is a phi and not a theta)? ... speeds of double stars do not affect the aberration angle. ... object emiting the light beam and the light beam always travels at "c" ...
    (sci.physics.relativity)
  • Re: Commutation Relations between L_i , x_i , p_i
    ... and rotating this vector arount the z axis by theta ... It necessarily follows that the same identities are ... Expand the rotation operators to first order in theta: ... manually terminate your lines at 71 characters, or make manual breaks ...
    (sci.physics.research)