0
$\begingroup$

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

$\endgroup$
3
  • $\begingroup$ Is Euler vector the same as Euler angles? $\endgroup$
    – tom
    Feb 7, 2013 at 10:33
  • $\begingroup$ The Euler angles you mention ("Euler vector in radians, (x2, y2, z2)") are under what rotation sequence convention. Typically for aircraft, these are roll/pitch/yaw wit the y-axis pointing away from gravity, Is this correct? $\endgroup$ Oct 28 at 0:31
  • $\begingroup$ You need the direction of travel in order to define where "behind" is. $\endgroup$ Oct 28 at 0:32

1 Answer 1

0
$\begingroup$

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.

see:http://en.wikipedia.org/wiki/Rotation_formalisms_in_three_dimensions#Conversion_formulae_between_formalisms

$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)

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .