# Euler rotation of objects with velocity vectors

1. Nov 7, 2007

### jimbo_durham

I have a number of objects (points) in a 3D space. I need to rotate this space using euler angles (or equivilent) and place it in another coordinate system. (ie i start with objects placed within the confines of a cylinder aligned with the z axis, and after rotation have a cylinder of objects at some chosen angle and orientation compaired to the z' axis in a larger cartesian space.)

Each one of these points in given an initial velocity, which must be kept during the rotations. ie if a point initialy has a velocity towards the center of the cylinder (the z axis before rotation), the velocity after rotation must be of the same magnitude and towards the center of the cylinder (ie NOT the new z' axis).

I can easily rotate the points, howoever i cannot work out how to rotate the velocity vectors about the origin with the points in order to keep the velocities true. can anyone suggest how i could do this please?

in case this is not clear, i shall give an example of one point

say i have a point which is on the point on the x axis with a vector representing its velocity pointing towards the z axis. a rotation in the xz plane of 90degrees would put the point on the z axis with the velocity pointing towards the xy plane.

hope this didnt make this more complicated. the important thing is not the velocity, it is simply a euler rotation of a point (x1,y1,z1) which has attached a vector (vx1, vy1, vz1) which starts at (x1,y1,z1).

what i need in the end is the point in the new coordinate system and the velocity vector associated with it.

can this be done and how?

thanks for reading all this
jimbo

Last edited: Nov 7, 2007
2. Nov 7, 2007

### D H

Staff Emeritus
First, let me get one thing off my chest: Euler angles are evil. I am going to assume you've done something sane with the evil Euler angles such as converting them to a rotation or transformation matrix.

I take care to distinguish between rotation and transformation matrices. Here is what I mean by the two terms:
• A rotation matrix describes the physical rotation of some object (i.e., your cylinder) in space. For example, the act of rotating a vector about some axis is a new vector. Assuming you are using column vectors, the coordinates of the new vector as expressed in some reference frame is the product of a rotation matrix and the coordinates of the old vector as expressed in the same reference frame.
• A transformation matrix describes how to transform some quantity (the same quantity) from one reference frame to another. For example, suppose you have the coordinates of a vector as expressed in some reference frame and want to express the vector in some other reference frame. There is only one vector, just two different representations of it. The transformed coordinates of the vector are the product of a transformation matrix and the original coordinates of the vector.

What you want to to is to rotate the object and transform the velocities. In this case, the transformation matrix is simply the transpose of the rotation matrix (and vice-versa).

3. Nov 7, 2007

### jimbo_durham

thanks for the quick reply.

for my application this is a computational problem involving lots of objects, and i have a line of code changing my (x,y,z) into (x',y',z') using three euler angles (equivilent to a rotation matrix).

this is easy to visualize, however i cannot easily visualize a change in the vector, because the vector is not just a change in coordinates, it remains in the direction defined by the orrigonal coordinate system which is then placed at a rotated position within the new system, so the vector has a new direction in the new referance frame. also the start point of the vector changes as it is attached to my point which itself is moved

...i might be confusing myself. if you can expand on your explanation so i can get my head round this that would be great.

4. Nov 7, 2007

### D H

Staff Emeritus
Is your "line of code" that changes your (x,y,z) to (x',y',z') a function call that takes a vector, three Euler angles as input and produces a rotated vector as output? If so, that function is computing the sine and cosine of each of the three angles, which is very wasteful when you do this for "lots of objects". You can save a lot of CPU time by pre-computing those values, or even better, by computing the rotation matrix. A simple function call (or even faster, a macro) will quickly compute the rotated vector.

The transformation matrix in question is just the transpose of the rotation matrix. Simply transform the velocity vectors. You don't even have to compute the transformation matrix. Just write a function or macro that computes RT*x as opposed to R*x.

5. Nov 8, 2007

### jimbo_durham

Thankyou. yes it is a function call to a routine which computes the sin/cos of the the three angles once before using that simple numerical values to calculate the rotations.

I understand what you have said about the transpose of the rotation matrix being a transform martic which simply changes the coordinate system of the old velocity vector into the new coordinate system. it always makes more sense in the morning

Again thank you for your help, will post back here if everything works for the benifit of anyone following this thread for their own work

6. Nov 8, 2007

### jimbo_durham

perfect, this method is indeed correct. Thankyou D H

7. Nov 8, 2007

### D H

Staff Emeritus
You're welcome, and good luck.

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?