source: trunk/MagicSoft/slalib/euler.c@ 6636

Last change on this file since 6636 was 731, checked in by tbretz, 24 years ago
*** empty log message ***
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#include "slalib.h"
2#include "slamac.h"
3void slaEuler ( char *order, float phi, float theta, float psi,
4 float rmat[3][3] )
5/*
6** - - - - - - - - -
7** s l a E u l e r
8** - - - - - - - - -
9**
10** Form a rotation matrix from the Euler angles - three successive
11** rotations about specified Cartesian axes.
12**
13** (single precision)
14**
15** Given:
16** *order char specifies about which axes the rotations occur
17** phi float 1st rotation (radians)
18** theta float 2nd rotation ( " )
19** psi float 3rd rotation ( " )
20**
21** Returned:
22** rmat float[3][3] rotation matrix
23**
24** A rotation is positive when the reference frame rotates
25** anticlockwise as seen looking towards the origin from the
26** positive region of the specified axis.
27**
28** The characters of order define which axes the three successive
29** rotations are about. A typical value is 'ZXZ', indicating that
30** rmat is to become the direction cosine matrix corresponding to
31** rotations of the reference frame through phi radians about the
32** old z-axis, followed by theta radians about the resulting x-axis,
33** then psi radians about the resulting z-axis.
34**
35** The axis names can be any of the following, in any order or
36** combination: x, y, z, uppercase or lowercase, 1, 2, 3. Normal
37** axis labelling/numbering conventions apply; the xyz (=123)
38** triad is right-handed. Thus, the 'ZXZ' example given above
39** could be written 'ZXZ' or '313' (or even 'zxz' or '3xz'). Order
40** is terminated by length or by the first unrecognized character.
41**
42** Fewer than three rotations are acceptable, in which case the later
43** angle arguments are ignored. Zero rotations leaves rmat set to the
44** identity matrix.
45**
46** Called: slaDeuler
47**
48** Last revision: 9 December 1996
49**
50** Copyright P.T.Wallace. All rights reserved.
51*/
52{
53 int j, i;
54 double w[3][3];
55
56/* Compute matrix in double precision */
57 slaDeuler ( order, (double) phi, (double) theta, (double) psi, w );
58
59/* Copy the result */
60 for ( j = 0; j < 3; j++ ) {
61 for ( i = 0; i < 3; i++ ) {
62 rmat[i][j] = (float) w[i][j];
63 }
64 }
65}
Note: See TracBrowser for help on using the repository browser.