# Apply Euler vector to translate vector

This is a problem for 3d graphics programming.

I have an object in 3d space, an airplane, who's position is (x1, y1, z1). The orientation (rotation) specified as a Euler vector in radians, (x2, y2, z2).

The airplane will be moving and rotating. I will want to place the camera at location (x4, y4, z4), which needs to be calculated. It will be calculated from a specified translation vector, (x3, y3, z3), where the vector is with respect to the airplane's space, rather than the 3d environment. This translation vector might be specified such that the camera is always looking at the rear of the airplane, or the top of the airplane, etc., irrespective of the airplane's orientation and position.

In other words, I may want to have the camera stay 2 units behind the airplane. So the translation vector I specify might be (2, 0, 0). Situation 1: If the airplane's position vector is (0,0,0) and its rotation vector is (0,0,0), then the camera position would be (2,0,0). Situation 2: If the airplane's position vector is (0,0,0) but its rotation vector is NOT (0,0,0), then the camera's position vector would NOT be (2,0,0).

I hope this makes sense.

What operations would I need to undertake to achieve:

Given:

• airplane position vector
• airplane rotation vector
• camera translation vector (with respect to airplane, given position AND rotation )

Calculate:

• camera's position vector

Thank you

-
Is Euler vector the same as Euler angles? – tom Feb 7 '13 at 10:33

If Euler vector is the same as Euler angles. Than is is not difficult to construct transformation from local space of plane to world space.

$v_{world} = R v_{local} + p_{plane}$

Where $R$ is rotation matrix qiven by Euler angles.

$p_{plane}$ is position of plane.

$v_{local}$ is given position of camera.

$(\phi,\theta,\psi)$ is your Euler vector. Than $R = A_3 A_2 A_1$ (matrices $A_i$ are those from wiki link)

-
Thanks, but that wikipedia page makes my head hurt! I was really hoping for an explanation that only uses simple maths terminology – Jodes Feb 7 '13 at 10:47
Answer editted. Hope that is enough. – tom Feb 7 '13 at 12:32