FACT++  1.0
double Moon::Angle ( double  r,
double  d 
) const
inline

Definition at line 402 of file smartfact.cc.

403  {
404  const double theta0 = M_PI/2-d*M_PI/180;
405  const double phi0 = r*M_PI/12;
406 
407  const double theta1 = M_PI/2-dec*M_PI/180;
408  const double phi1 = ra*M_PI/12;
409 
410  const double x0 = sin(theta0) * cos(phi0);
411  const double y0 = sin(theta0) * sin(phi0);
412  const double z0 = cos(theta0);
413 
414  const double x1 = sin(theta1) * cos(phi1);
415  const double y1 = sin(theta1) * sin(phi1);
416  const double z1 = cos(theta1);
417 
418  double arg = x0*x1 + y0*y1 + z0*z1;
419  if(arg > 1.0) arg = 1.0;
420  if(arg < -1.0) arg = -1.0;
421 
422  return acos(arg) * 180/M_PI;
423  }
double ra
Definition: moon.cc:18
double dec
Definition: moon.cc:19