FACT++  1.0
void palDe2h ( double  ha,
double  dec,
double  phi,
double *  az,
double *  el 
)

Definition at line 99 of file palDe2h.c.

References PAL__D2PI.

Referenced by t_e2h().

99  {
100 
101  double sh;
102  double ch;
103  double sd;
104  double cd;
105  double sp;
106  double cp;
107 
108  double a;
109 
110  double x;
111  double y;
112  double z;
113  double r;
114 
115  /* Useful trig functions */
116  sh = sin(ha);
117  ch = cos(ha);
118  sd = sin(dec);
119  cd = cos(dec);
120  sp = sin(phi);
121  cp = cos(phi);
122 
123  /* Az,El as x,y,z */
124  x = -ch * cd * sp + sd * cp;
125  y = -sh * cd;
126  z = ch * cd * cp + sd * sp;
127 
128  /* To spherical */
129  r = sqrt(x * x + y * y);
130  if (r == 0.) {
131  a = 0.;
132  } else {
133  a = atan2(y, x);
134  }
135  if (a < 0.) {
136  a += PAL__D2PI;
137  }
138  *az = a;
139  *el = atan2(z, r);
140 
141  return;
142 }
static const double PAL__D2PI
Definition: palmac.h:66

+ Here is the caller graph for this function: