# Calculation of Euler angles X' Y1 X

Calculation of Euler angles

Prokopi Nikolaev

geom3d@

The common transformation task using Euler angles consists of 3 rotations (Fig. 1):

1. Rotate around Z1 axis local coordinate system (LCS) by angle . 2. Rotate around transformed X1 axis (X' on Fig. 1) by angle . 3. Rotate around transformed Z1 axis by angle .

Z

Z1 Y

Y1

The angles , , are called precession, nutation and rotation respectively.

The presented algorithm allows obtaining Euler angles for transformation zero-based orthogonal LCS into world coordinate system (WCS).

X, Y, Z are axis of WCS:

X'

X X1

Fig. 1

X = (1, 0, 0), Y = (0, 1, 0), Z = (0, 0, 1).

It is implied that axis X1, Y1, Z1 of LCS are defined in WCS:

X1 = (X1x, X1y, X1z), Y1 = (Y1x, Y1y, Y1z), Z1 = (Z1x, Z1y, Z1z).

The first step is to find . We should calculate the rotation angle around Z1 axis to place X1 axis into XY

plane of WCS. Let's see how to do it. The new position of X1 is X' on Fig.1 should satisfy two conditions:

it should be perpendicular to Z axis because it lies in XY plane. And it

Y1

should be perpendicular to Z1 axis because it is still part of LCS. So

the best candidate to the role of X' is a vector product of Z1 and Z:

X'

X' = Z1?Z = (Z1y, ?Z1x, 0).

X1' y

Now, when the vector X' is found it is easy to find . It is the angle between X1 and X'. To calculate it let's move into plane X1Y1 of LCS

X1' x

Fig. 2

(Fig. 2). This plane contains X'. X1

Angle can be obtained using standard library function atan2(y,x). This function calculates the arctangent of y/x and is very convenient for

our purpose. To use it we need projections of X' on X1 and Y1 axes. These projections (X1'x and X1'y) are scale products of X' to X1 and Y1:

X1'x = X'?X1 = X'x?X1x + X'y?X1y + X'z?X1z = Z1y?X1x ? Z1x?X1y,

X1'y = X'?Y1 = X'x?Y1x + X'y?Y1y + X'z?Y1z = Z1y?Y1x ? Z1x?Y1y.

= atan2 (X1'y, X1'x).

The next step ? find ? the angle of rotation

around X'.

Z

Y

The picture (Fig. 3 a) shows the plane containing

Z1

Z and Z1. This plane is perpendicular to X', so

the rotation of Z1 to Z will take place in this plane. The required is the angle between Z1 and Z. Again we can use atan2 to calculate it. The projection of Z1 to Z is defined as Z1z. Z1xy is the projection of Z1 to XY plane of WCS (Fig. 3 b):

Z1 z

Z1 Z1

y

Z1

Z1

X

.

xy

x

a)

b)

And the angle is:

Fig. 3

atan2 (Z1xy, Z1z).

The last angle is . This is the angle between X' and X (Fig.4).

It can be found in the same way: Y

= ?atan2 (X'y, X'x) = ?atan2 (?Z1x, Z1y).

X'

There is one special case. This algorithm does not work when Z and Z1 are

collinear. In this case we should use different approach. In fact algorithm

becomes trivial:

X' y

X' x

= 0,

= 0 for Z1z > 0,

= ?atan2 (X1y, X1x).

= otherwise,

X To distinguish this special case we can use the value of Z1xy ? projection

Fig. 4

length of Z1 to XY plane. For special case it will be 0.

The final remark: in order to get Euler angles for back transformation of WCS to LCS we can simply change signs of angles and exchange with .

In conclusion there is a C-cod implementation of the described algorithm.

#include #include

#define PI 3.141592653589793

void LCS2Euler ( double X1x, double X1y, double X1z, double Y1x, double Y1y, double Y1z, double Z1x, double Z1y, double Z1z, double *pre, double *nut, double *rot) { double Z1xy = sqrt (Z1x*Z1x + Z1y*Z1y); if (Z1xy > DBL_EPSILON) { *pre = atan2 (Y1x*Z1y - Y1y*Z1x, X1x*Z1y - X1y*Z1x); *nut = atan2 (Z1xy, Z1z); *rot = -atan2 (-Z1x, Z1y); } else { *pre = 0.; *nut = (Z1z > 0.) ? 0. : PI; *rot = -atan2 (X1y, X1x); } }

................

................

#### To fulfill the demand for quickly locating and searching documents.

It is intelligent file search solution for home and business.

##### Related download

- math 1316 general review for trigonometry last updated
- trigonometric identities calculator with steps
- math for surveyors esri
- solarcalcs arizona state university
- calculation of euler angles x y1 x
- size distance and angle 1 university of exeter
- 7 7 solve right triangles
- express each ratio as a fraction and as a
- how to find angle using pythagorean theorem
- math 098 review for midterm most of the test will allow

##### Related searches

- sun angle calculator by zip code
- sun angle calculator by location
- angle calculator tool
- angle calculator free
- right angle calculator in inches
- right angle calculator in excel
- angle calculator triangles
- how to find angle measures in geometry
- find angle theta calculator
- find the angle calculator of a triangle
- how to find angle of triangle
- trig find angle calculator