1 
2 /*
3  * rot.h
4  *
5  * FUNCTION:
6  * rotation matrix utilities
7  *
8  * HISTORY:
9  * Linas Vepstas Aug 1990
10  */
11 
12 /* ========================================================== */
13 /*
14  * The MACROS below generate and return more traditional rotation
15  * matrices -- matrices for rotations about principal axes.
16  */
17 /* ========================================================== */
18 
19 #define ROTX_CS(m,cosine,sine)		\
20 {					\
21    /* rotation about the x-axis */	\
22 					\
23    m[0][0] = 1.0;			\
24    m[0][1] = 0.0;			\
25    m[0][2] = 0.0;			\
26    m[0][3] = 0.0;			\
27 					\
28    m[1][0] = 0.0;			\
29    m[1][1] = (cosine);			\
30    m[1][2] = (sine);			\
31    m[1][3] = 0.0;			\
32 					\
33    m[2][0] = 0.0;			\
34    m[2][1] = -(sine);			\
35    m[2][2] = (cosine);			\
36    m[2][3] = 0.0;			\
37 					\
38    m[3][0] = 0.0;			\
39    m[3][1] = 0.0;			\
40    m[3][2] = 0.0;			\
41    m[3][3] = 1.0;			\
42 }
43 
44 /* ========================================================== */
45 
46 #define ROTY_CS(m,cosine,sine)		\
47 {					\
48    /* rotation about the y-axis */	\
49 					\
50    m[0][0] = (cosine);			\
51    m[0][1] = 0.0;			\
52    m[0][2] = -(sine);			\
53    m[0][3] = 0.0;			\
54 					\
55    m[1][0] = 0.0;			\
56    m[1][1] = 1.0;			\
57    m[1][2] = 0.0;			\
58    m[1][3] = 0.0;			\
59 					\
60    m[2][0] = (sine);			\
61    m[2][1] = 0.0;			\
62    m[2][2] = (cosine);			\
63    m[2][3] = 0.0;			\
64 					\
65    m[3][0] = 0.0;			\
66    m[3][1] = 0.0;			\
67    m[3][2] = 0.0;			\
68    m[3][3] = 1.0;			\
69 }
70 
71 /* ========================================================== */
72 
73 #define ROTZ_CS(m,cosine,sine)		\
74 {					\
75    /* rotation about the z-axis */	\
76 					\
77    m[0][0] = (cosine);			\
78    m[0][1] = (sine);			\
79    m[0][2] = 0.0;			\
80    m[0][3] = 0.0;			\
81 					\
82    m[1][0] = -(sine);			\
83    m[1][1] = (cosine);			\
84    m[1][2] = 0.0;			\
85    m[1][3] = 0.0;			\
86 					\
87    m[2][0] = 0.0;			\
88    m[2][1] = 0.0;			\
89    m[2][2] = 1.0;			\
90    m[2][3] = 0.0;			\
91 					\
92    m[3][0] = 0.0;			\
93    m[3][1] = 0.0;			\
94    m[3][2] = 0.0;			\
95    m[3][3] = 1.0;			\
96 }
97 
98 /* ========================================================== */
99