Results 1 to 9 of 9

Math Help - Finding a rotation matrix

  1. #1
    Newbie
    Joined
    May 2010
    Posts
    10

    Finding a rotation matrix

    This is from our computer graphics class:

    We have a unit sphere centered at the origin

    We are given a rotation matrix R and a perspective projection matrix P
    Let p be a unit vector that lies on the sphere.
    then

    c=P*R*p

    and so c is the screen coordinate of p after being rotated by R and then projected using P.

    Now for the question:
    We are now provided with a different c which we shall call c1 and told that P and p remain the same. The question is what rotation matrix R1 will take p to c1?

    Obviously this will produce an underconstrained system so the constraints are defined to be that R is composed of two axis rotations Rx(phi) (rotation of phi about x) and Rz(theta) (rotation of theta about z) such that

    R=Rz(theta)*Rx(phi)

    So the question boils down to
    solve c1=P*Rz(theta)*Rx(phi)*p for theta and phi

    You may assume that inv(P) exists or that we know the value of inv(P)*c1
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Newbie
    Joined
    May 2010
    Posts
    10
    The question could be made equivalent to this:

    Given two points on a sphere p1 and p2 find theta and phi such that

    Rx(phi)*Rz(theta)*p1=p2

    where Rx(phi) is a rotation about x axis by phidegrees and Rz(theta) is a rotation about z axis by theta degrees
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Jan 2009
    Posts
    153
    Generally, projection transformation from 3D to Plane is NOT invertible.
    R is a span of matrices
    Last edited by math2009; November 24th 2010 at 04:07 PM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Newbie
    Joined
    May 2010
    Posts
    10
    Quote Originally Posted by math2009 View Post
    Generally, projection transformation from 3D to Plane is NOT invertible.
    R is a span of matrices
    Actually thats not entirely true. In computer graphics projection matrices are designed to be invertible and this is possible because they are usually 4x4 homogeneous transformations.

    In any case I specified
    You may assume that inv(P) exists or that we know the value of inv(P)*c1
    The question can be made equivalent to asking the following:

    given two points on a sphere p1 and p2
    find the two rotations Rx and Rz such that
    p2=Rx * Rz * p1
    Follow Math Help Forum on Facebook and Google+

  5. #5
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Newbie
    Joined
    May 2010
    Posts
    10
    Hi
    I have one method which works fine but was hoping someone would give me a purer method.

    My method is to simply let v=p2-p1

    then convert v into polar coordinates and extract theta and phi from those equations

    Id really like to know how I can find Rx and Rz as the solutions to a set of constraints
    Follow Math Help Forum on Facebook and Google+

  7. #7
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    I have one method which works fine but was hoping someone would give me a purer method.
    Do you mean "simpler" method?

    convert v into polar coordinates
    Do you mean spherical coordinates? I'm not sure your method will work, because, while v would represent the difference of the two vectors, v is a straight-line way of getting from p1 to p2, whereas you are doing rotations to get there.

    You may not be able to find just an Rx and Rz to rotate p1 to p2. You may also need an Ry.

    Was the link I gave you at all helpful?
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    May 2010
    Posts
    10
    Hi
    Thanks for replying. The "purer" method I was hoping for would be one with less fiddling i.e. something involving extracting Rx and Rz directly without resorting to finding their parameters. But I have no idea whether or not that kind of solution exists.

    In any case I did indeed mean spherical coordinates.

    And in terms of the vector v:
    You are right, that method probably wouldnt work. What I meant and did in practice is that I converted p1 and p2 into spherical coordinates and then found the latitude and longitude angle differences and used those as the inputs to Rx and Rz
    Follow Math Help Forum on Facebook and Google+

  9. #9
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Hmm. Well, you could certainly try your method. It seems plausible. You would probably want to apply the x rotation first, not the z rotation as in your post # 4. Rotations in 3 dimensions are not, in general, commutative.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 0
    Last Post: January 14th 2012, 08:02 PM
  2. Finding rotation matrix
    Posted in the Advanced Algebra Forum
    Replies: 4
    Last Post: March 23rd 2011, 06:39 AM
  3. Verifying that a matrix is a rotation matrix
    Posted in the Advanced Algebra Forum
    Replies: 5
    Last Post: October 27th 2009, 11:43 AM
  4. 2d rotation matrix...
    Posted in the Trigonometry Forum
    Replies: 0
    Last Post: October 27th 2009, 10:13 AM
  5. The Rotation Matrix
    Posted in the Advanced Algebra Forum
    Replies: 1
    Last Post: March 28th 2008, 07:37 PM

Search Tags


/mathhelpforum @mathhelpforum