LALSimulation  5.4.0.1-fe68b98
rotation_macros.h
Go to the documentation of this file.
1 #include <math.h>
2 #include <lal/LALConstants.h>
3 
4 
5 /* Macro functions to rotate the components of a vector about an axis */
6 #define ROTATEZ(angle, vx, vy, vz)\
7  tmp1 = vx*cos(angle) - vy*sin(angle);\
8  tmp2 = vx*sin(angle) + vy*cos(angle);\
9  vx = tmp1;\
10  vy = tmp2
11 
12 #define ROTATEY(angle, vx, vy, vz)\
13  tmp1 = vx*cos(angle) + vz*sin(angle);\
14  tmp2 = - vx*sin(angle) + vz*cos(angle);\
15  vx = tmp1;\
16  vz = tmp2
17 
18 /* here's the reference explaining why we perform this rotation https://dcc.ligo.org/LIGO-G1900275 */
19 #define ROT_HP_HC(hp, hc, omega) \
20  if ((omega) != 0.0) { \
21  REAL8 _c = cos(2.0 * omega); \
22  REAL8 _s = sin(2.0 * omega); \
23  for (UINT4 _ind = 0; _ind < (hp)->data->length; ++_ind) { \
24  REAL8 _x = (hp)->data->data[_ind]; \
25  REAL8 _y = (hc)->data->data[_ind]; \
26  (hp)->data->data[_ind] = _c * _x + _s * _y; \
27  (hc)->data->data[_ind] = _c * _y - _s * _x; \
28  } \
29  } else ((void)0)