Page 1 of 2 12 LastLast
Results 1 to 15 of 25

Math Help - Move and Rotate a point around a new origin

  1. #1
    Newbie
    Joined
    Jan 2011
    Posts
    13

    Move and Rotate a point around a new origin

    I'm trying to do something like this:
    Move and Rotate a point around a new origin-vectorq.jpg

    The pyramid is linked to the box. I have the positions and rotations of both the green box and the green pyramid. The axis intersecting the green box is at (0, 0, 0) with a rotation of (0, 0, 0). I want to move and rotate this group to the new axis centered in the purple box. I have the position and rotation of the purple box. What I need to know is how to calculate the new rotation and position of the red pyramid.

    It's been quite a while since I've done stuff like this, so if someone could help me with formulas and how to use them to calculate the new rotation and position, I would appreciate it.


    Here's an example if it would help:
    Green box position: (0, 0, 0)
    Green box rotation: (0, 0, 0)
    Green pyramid position: (-24.81, 43.0345, 4)
    Green pyramid rotation: (0, -0.22, 0.64)

    Purple box position: (49.4771, 90.9461, 61.0026)
    Purple box rotation: (-0.12217, -0.2967, 0.38397)
    Red pyramid position: (?, ?, ?)
    Red pyramid rotation: (?, ?, ?)

    I'm working on this for a game.
    If I use the mission editor, I can get the location and rotation of the red pyramid, and it is:
    Red pyramid position: (10.6201, 120.922, 52.3397)
    Red pyramid rotation: (-0.274722, -0.386207, 1.01696)


    Unfortunately, there is no way to access the function the mission editor uses to rotate the group, so I need math formulas so I can manually do it.

    Thanks,
    Liger
    Follow Math Help Forum on Facebook and Google+

  2. #2
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    I have a few questions for you.

    1. It appears possible that you could rotate first and then translate. Is that correct? I mention it because the order matters.
    2. I have no idea what your rotation vector is. Is that a rotation about the x, y, and z axes, respectively? Or Euler rotations?

    What might help to determine the answer to question 2, if you don't already know the answer, is, if you have the option of querying the mission editor, to put in, say, a 90 degree rotation about the x axis with no translation, then one about the y axis with no translation, and finally one about the z axis with no translation. Then I can see better whether you're working in radians or degrees, and what each number means. Does that make sense?
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2011
    Posts
    13
    1. It appears possible that you could rotate first and then translate. Is that correct? I mention it because the order matters.
    Yes, the pyramid can be rotated first, and then moved.

    2. I have no idea what your rotation vector is. Is that a rotation about the x, y, and z axes, respectively? Or Euler rotations?
    The rotations are in radians, and are x, y, and z axes respectively. The positions are also, x, y, and z axes respectively.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Ok, here's the question I am now asking myself: why isn't the red pyramid's rotation the same as the purple box's rotation? For that matter, why isn't the green pyramid's rotation the same as the green box's rotation (zero)?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Jan 2011
    Posts
    13
    The image is just an example to help explain the situation. In actuality, the green pyramid is slightly rotated. I can get an actual picture if that will help.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    The actual picture wouldn't hurt, I'm sure. One more question: are these rotations happening "in place"? That is, does the rotation of a pyramid, say, affect its position, or not? Perhaps you can visualize in your mind the difference between rotating a cylinder centered at the origin about any axis (thus, not changing its position but merely its orientation), and rotating a cylinder that is not centered at the origin about any axis (which will affect its position).
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Newbie
    Joined
    Jan 2011
    Posts
    13
    Here's the image:
    http://img375.imageshack.us/img375/9610/rotated.png

    The left side correlates to the green box and green pyramid.
    The right side correlates to the purple box and red pyramid.

    The big base is the box, and the antenna with the green dot is the pyramid.


    I took the base and antenna, and moved it to a new location with a new rotation as well. The bases and antennas have the same values as posted in the initial post.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    So I take it the antenna's position is fixed relative to the base. Correct? And the rotation you're actually doing with the antenna is sort of "about its long axis", right? Like a periscope?
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Jan 2011
    Posts
    13
    Quote Originally Posted by Ackbeet View Post
    So I take it the antenna's position is fixed relative to the base. Correct?
    Yes


    Quote Originally Posted by Ackbeet View Post
    And the rotation you're actually doing with the antenna is sort of "about its long axis", right? Like a periscope?
    I select both objects and rotate them as a group, that way the antenna does not leave that spot on the base.
    Follow Math Help Forum on Facebook and Google+

  10. #10
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    So is the antenna always facing the same direction relative to the base? Forget the base rotation for second: it looks like you're rotating the antenna on its spot. It's revolving, like a revolving door. Is that rotation happening? Or is the antenna's direction always fixed relative to the base?
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Newbie
    Joined
    Jan 2011
    Posts
    13
    It is physically attached to the building and cannot move from that spot. The game does not know this, so I must place it there manually.
    Follow Math Help Forum on Facebook and Google+

  12. #12
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Ok, got that, but what I'm really after is whether the antenna can rotate about its fixed spot. Think of the antenna as a spinning top, spinning in place. Is that kind of rotation allowed?
    Follow Math Help Forum on Facebook and Google+

  13. #13
    Newbie
    Joined
    Jan 2011
    Posts
    13
    Yes, it has a Z-axis that would allow such a rotation. I can rotate the antenna however I want. I just need it to look like it hasn't moved in the end result.
    Follow Math Help Forum on Facebook and Google+

  14. #14
    A Plied Mathematician
    Joined
    Jun 2010
    From
    CT, USA
    Posts
    6,318
    Thanks
    4
    Awards
    2
    Ok. I think I've got my mind wrapped around this problem. You're going to need a number of translations and rotations. You can do rotations with rotation matrices. But those rotations are only valid for rotations about the normal x, y, and z axes. They are not valid for rotations about an arbitrary axis. Therefore, in order to use them properly, you're going to have to translate and rotate until things are lined up correctly. Here's the algorithm as I see it:

    1. Translate the base-antenna system until the base of the antenna is at the origin.
    2. If necessary, rotate the base-antenna system until the antenna is lined up with either the x, y, or z axes.
    3. Rotate the antenna by itself about its now-aligned axis until its orientation relative to the base is correct.
    4. Rotate the base-antenna system as desired.
    5. Translate the base-antenna system as desired.

    That should do it. Do you need more details, or is this enough to be going on with?
    Follow Math Help Forum on Facebook and Google+

  15. #15
    Newbie
    Joined
    Jan 2011
    Posts
    13
    How do I mathematically compute each of those? There is no means to "rotate by", only to assign world coordinates and rotations. So I need to be able to calculate the new location (x,y,z) and rotation (i,j,k) of the antenna based on the initial offset from the origin and by knowing the new position and rotation of the new base's coordinates and rotation.
    Follow Math Help Forum on Facebook and Google+

Page 1 of 2 12 LastLast

Similar Math Help Forum Discussions

  1. Contraction mapping of a cone, show origin must move.
    Posted in the Differential Geometry Forum
    Replies: 2
    Last Post: August 15th 2011, 11:18 AM
  2. Rotate a rectangle with respect to a point
    Posted in the Trigonometry Forum
    Replies: 2
    Last Post: August 20th 2009, 02:13 AM
  3. Rotate a line about a point
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: August 18th 2009, 10:24 AM
  4. move a point along a plane in 3d space
    Posted in the Calculus Forum
    Replies: 3
    Last Post: June 22nd 2009, 11:27 AM
  5. Using sin and cos to rotate a point
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: September 10th 2007, 09:07 AM

Search Tags


/mathhelpforum @mathhelpforum