# Determining the orientation of ellipsoids after 2 rotations

1. Jun 17, 2011

### lemonCBI

I am writing some code in which I am working with ellipsoids. The ellipsoids can be rotated in its body frame with three angles (First rotation is about the z-axis in the body frame, second is about the y-axis in the body frame, and finally another rotation about the z-axis in the body frame). In addition, a group of ellipsoids can be rotated together. This means an individual ellipsoid is rotated in the same manner as before except the point of rotation is not necessarily the center of the ellipse.

My question is how do I calculate the 3 angles (Z-Y-Z) that describe the position an ellipsoid that has experienced both rotations? I have the 3 angles of the body rotation, the 3 angles of second rotation, and the displacement of the ellipsoid center from the point of rotation.

Also, in trying to figuring this out I was wondering if an ellipsoid's position has unique set of angles to describe it or if there are several correct answers (besides multiples of 360)

2. Jun 20, 2011

### Unrest

You can combine a sequence of two or more rotations/translations by representing the transformations as matrices and multiplying the matrices together. Wikipedia has a pretty comprehensive page on transformation matrices.

I wonder how you represent the orientation of an ellipsoid. Is it by another set of angles, or by vectors or quaternions? Are they relative to some fixed global coordinate system? I guess you also have a position vector for each ellipsoid? In rectangular coordinates?

3. Jun 20, 2011

### chiro

If your points of an object are with respect to the body's origin, a simple rotation will suffice. You can use a linear transformation, or use something like a quaternion rotation and then convert that to a matrix which you can apply as a standard linear transformation.

If you want to rotate with respect to a point that is not the origin, you need to translate the point you are rotating by the negative of the point you wish to rotate around, perform your rotation and then translate back.

If you really want to you could manually pre-compute a final matrix that will be your linear transformation that is composed of all necessary linear maps (translations and rotations) if you really need a speed edge, but modern computers can do this quick enough nowadays.

In terms of angles, with rotations you usually supply them. If however you instead have a final rotation point, you can use methods to extract the angle from these.