Rotating a vector about a new origin

AI Thread Summary
To rotate a vector about a new origin in 3D space, first determine the position of the vector relative to the original origin. Next, apply a series of three rotations to align the original axes with the new axes, ensuring that you account for the differences in orientation. After achieving the correct alignment, translate the vector to the new origin by adding the positional difference between the two origins. It's recommended to use quaternions or direction cosine matrices for these calculations to avoid singularities associated with Euler angles. Following these steps will yield the new position and rotation values for the vector.
LigerZero
Messages
4
Reaction score
0
I have a point in 3d space at (x, y, z) with a rotation of (i, j, k) based from the origin (0, 0, 0) with a rotation of (0, 0, 0). What I would like to do is move the origin to a new position and rotation and have the point rotated with it. What series of calculations and manipulations need to be performed to get the point's new position and rotation values?
 
Physics news on Phys.org
Welcome to PF!

Hi LigerZero! Welcome to PF! :smile:

A combination of two equal but opposite rotations about parallel axes is equal to a translation …

does that help?
 
Not particularly. It's been quite awhile since I've done this sort of thing, so you'll need to be more specific on how to get each of those and use them to reach to final two values.
 
LigerZero said:
I have a point in 3d space at (x, y, z) with a rotation of (i, j, k) based from the origin (0, 0, 0) with a rotation of (0, 0, 0). What I would like to do is move the origin to a new position and rotation and have the point rotated with it. What series of calculations and manipulations need to be performed to get the point's new position and rotation values?

I'm not quite sure what you're trying to say, but, generally, translation and rotation are handled separately. The translation accounts for the difference in origins and the rotation accounts for the difference in the direction of the axes.
 
I'm trying to do something like this:
http://img28.imageshack.us/img28/8945/vectorq.th.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 that position and rotation. What I need to know is how to calculate the new rotation and position of the red pyramid.
 
Last edited by a moderator:
LigerZero said:
I'm trying to do something like this:
http://img28.imageshack.us/img28/8945/vectorq.th.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 that position and rotation. What I need to know is how to calculate the new rotation and position of the red pyramid.

Determine the position of the green pyramid relative to the green origin. Rotate so the green axes are parallel to the blue axes (rotation). This gives you the location of the green pyramid relative to the green origin, but in the blue coordinate system. Add in the difference between the blue origin and the green origin (translation).

You need 3 rotations. The straight forward method is to rotate around the green x until the green y lies in the blue x-y plane. Then rotate around the green y until the green and blue z's are parellel. Then rotate around the z until the x's and y's are parallel. The angles have to be something you can determine (roll, pitch, yaw, for example).

If those 3 angles are hard to define, you can take advantage of the fact that a ZXZ rotation duplicates the XYZ rotation (right ascension of ascending node, inclination, argument of perigee, for example).

Watch out for singularities if you use Euler angles (the rotations described in the previous paragraphs). Most programmers use quaternions or direction cosine matrices for the graphics in video games, since those two methods don't have singularities (even though they're harder methods to learn).
 
Last edited by a moderator:
Assuming it's possible to use either of those methods (this game doesn't provide those systems, but looking around, it should be possible to implement them), what would I need to do, step-by-step, to get the new rotation and position?
 

Similar threads

Back
Top