Hello to you math-guys,

here is my problem:

I want to rotate a (physically existing) globe being held by a robot.

Input are polar coordinates (longitude / latitude).

The special requirement is, that the resulting rotation should only include two of the three axes:

Rotation around earth’s axis (Z-rotation),

und tilting of the globe (in this case X-rotation).

Target representation of the rotation should be a quaternionen.

for now, the pseudo-code looks something like this:

(world / init coordinate system:

X-axis pointing to the right, Y-axis pointing towards viewer, Z-axis pointing upwards)

Vec3D Vref = (0, 0, 1)

double turnZ = longitude

double turnX = latitude

// calculate direction vector by lat / long

Vec3D V1 = LatLongToXYZ(turnZ, turnX);

// calculate rotational difference between two (normalized) vectors

Quaternion Qerg = CalcQuatFromVectors(Vref, V1);

(the calculation methods are implemented in Java …,

vvvv here is only used for visualizing calculation results)

It works fine so far, except the fact, that the resulting rotation also includes rotation around Y-axis.

But what I need, is that after applying the calculated rotation to the init-rotation, the resulting Z-axis should always be parallel to a plane E-init, which is defined by the Y and Z axis of the init-rotation.

I can’t figure out, how to “exclude” the rotation around Y-axis for my result properly …

Any help for this would be highly appreciated!

Thanks in advance