Results 1 to 4 of 4

Math Help - Solve for rotations {rx,ry,rx} given before and after vectors

  1. #1
    BPW
    BPW is offline
    Newbie
    Joined
    Oct 2008
    From
    Houston
    Posts
    2

    Solve for rotations {rx,ry,rx} given before and after vectors

    We can use the 3x3 rotation matrix R to determine the effect of rotations about the principle axes:

    Vafter = R.Vbefore

    That's straightforward.

    Does anyone know what the strategy should be for solving for unknown rotations r={rx,ry,rx} radians, given we know Vbefore and Vafter?
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    15,367
    Thanks
    1311
    Quote Originally Posted by BPW View Post
    We can use the 3x3 rotation matrix R to determine the effect of rotations about the principle axes:

    Vafter = R.Vbefore

    That's straightforward.
    Then presumably you know that a rotation about the x-axis though angle rx is given by the matrix with rows [1 0 0], [0 cos(rx) -sin(rx)], [0 sin(rx) cos(rx)], that a rotation about the y-axis through angle ry is given by the matrix [cos(ry) 0 -sin(ry)], [0 1 0], [sin(ry), 0 cos(ry)], and that the rotation around the z-axis through an angle rz is given by the matrix [cos(rz) -sin(rz) 0], [sin(rz) cos(rz) 0], [0 0 1].

    And the rotation matrix R is the product of those matrics.

    Does anyone know what the strategy should be for solving for unknown rotations r={rx,ry,rx} radians, given we know Vbefore and Vafter?
    Go ahead and multiply the matrices above by the Vbefore vector, and set the result equal to the Vafter vector. That gives you three equations to solve for vx, vy, and vz. (I presume you meant {rx,ry,rz}, not {rx,ry,rx}.)
    Follow Math Help Forum on Facebook and Google+

  3. #3
    BPW
    BPW is offline
    Newbie
    Joined
    Oct 2008
    From
    Houston
    Posts
    2
    Hi Halls.....
    yes I realize Rzyx = Rx.Ry.Rz and that I can multiply out the equations. You get three simultaneous equations with anglex, angley and anglez as the unknowns - the problem is these equations involve Sin and Cos terms and are rather tricky to solve. For example, and there are multiple solutions. I've also read there are problems with 'ambiguities' - by that, I think they mean the solutions are:

    angle = C x Pi + function

    where C is a member of the class of integers. The solutions seem to have branching. I do wonder if I have stumbled over the rationale for using quaternions!






    Quote Originally Posted by HallsofIvy View Post
    Then presumably you know that a rotation about the x-axis though angle rx is given by the matrix with rows [1 0 0], [0 cos(rx) -sin(rx)], [0 sin(rx) cos(rx)], that a rotation about the y-axis through angle ry is given by the matrix [cos(ry) 0 -sin(ry)], [0 1 0], [sin(ry), 0 cos(ry)], and that the rotation around the z-axis through an angle rz is given by the matrix [cos(rz) -sin(rz) 0], [sin(rz) cos(rz) 0], [0 0 1].

    And the rotation matrix R is the product of those matrics.


    Go ahead and multiply the matrices above by the Vbefore vector, and set the result equal to the Vafter vector. That gives you three equations to solve for vx, vy, and vz. (I presume you meant {rx,ry,rz}, not {rx,ry,rx}.)
    Follow Math Help Forum on Facebook and Google+

  4. #4
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7
    The vectors \mathbf{v}_{\text{after}} and \mathbf{v}_{\text{before}} obviously have to have the same length, or you can't rotate one to coincide with the other. Let's assume that they are both unit vectors.

    I'm going to start with one unit vector \mathbf{v} = (a,b,c), with a^2+b^2+c^2 = 1. Let \theta =\arccos{a} and let d = b/\sin\theta,\ e = c/\sin\theta. (That can't be done if \sin\theta=0, but we'll come back to that later.) Then \mathbf{v} = (\cos\theta,d\sin\theta,e\sin\theta), and d^2+e^2=1. So we can find \phi such that \cos\phi =d,\ \sin\phi = e, and \mathbf{v} = (\cos\theta,\sin\theta\cos\phi,\sin\theta\sin\phi).

    Let \mathbf{u} = (1,0,0). Then it is easy to check that \mathbf{v} = X_\phi Z_\theta\mathbf{u}, where X_\phi is a rotation of \phi radians about the x-axis and Z_\theta is a rotation of \theta radians about the z-axis. The inverse transformation is given by \mathbf{u} =  Z_{-\theta}X_{-\phi}\mathbf{v}.

    Now if you are given two vectors \mathbf{v_1} and \mathbf{v_2}, you can rotate \mathbf{v_1} to \mathbf{v_2} by rotating it first to \mathbf{u} and then on to \mathbf{v_2}.

    Thus \mathbf{v_2} = X_{\phi_2}Z_{\theta_2-\theta_1}X_{-\phi_1}\mathbf{v_1}. That is more or less what you wanted. I seem to have ended with rotations {rx,rz,rx} rather than the {rx,ry,rx} that you wanted, so you'll have to switch the axes round to get that.

    Finally, what happens if \sin\theta=0? In that case, \cos\theta = \pm1 and the vector \mathbf{v} will be (\pm1,0,0). If the sign is +, then \mathbf{v} is already equal to \mathbf{u}. If it is -, then the rotation Z_\pi will swing it round to \mathbf{u}.
    Last edited by Opalg; October 20th 2008 at 03:38 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. solve perpendicular vectors problem
    Posted in the Calculus Forum
    Replies: 4
    Last Post: December 7th 2009, 06:14 PM
  2. 3D rotations of model to match unit vectors
    Posted in the Advanced Math Topics Forum
    Replies: 0
    Last Post: July 27th 2009, 07:23 AM
  3. Rotations
    Posted in the Geometry Forum
    Replies: 2
    Last Post: March 31st 2009, 02:09 PM
  4. solve with vectors
    Posted in the Pre-Calculus Forum
    Replies: 2
    Last Post: April 22nd 2008, 11:44 AM
  5. Rotations ????
    Posted in the Geometry Forum
    Replies: 4
    Last Post: January 16th 2008, 11:44 PM

Search Tags


/mathhelpforum @mathhelpforum