IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4716


Ignore:
Timestamp:
Aug 5, 2005, 9:56:18 AM (21 years ago)
Author:
eugene
Message:

fixed test for out-of-bounds AIT coords

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libohana/src/coordops.c

    r3466 r4716  
    1212  int Zenith1, Zenith2, Zenithal, Polynomial, Cartesian, PseudoCyl;
    1313  char *type;
    14   double L, M, X, Y, T, Z;
     14  double L, M, X, Y, T, Z, Z2;
    1515  double R, sphi, cphi, stht, ctht;
    1616  double alpha, delta, salp, calp, sdel, sdp, cdp;
     
    113113  if (PseudoCyl) {
    114114    if (!strcmp(type, "-AIT")) {
    115       Z = sqrt (1.0 - SQ(RAD_DEG*0.25*L) - SQ(RAD_DEG*0.5*M));
    116       alpha = 2.0 * DEG_RAD * atan2 (RAD_DEG*0.5*Z*L, 2.0*SQ(Z) - 1.0);
     115      Z2 = (1.0 - SQ(RAD_DEG*0.25*L) - SQ(RAD_DEG*0.5*M));
     116      if (Z2 < 0) return (FALSE);
     117      Z = sqrt (Z2);
     118      alpha = 2.0 * DEG_RAD * atan2 (RAD_DEG*0.5*Z*L, 2.0*Z2 - 1.0);
    117119      delta = DEG_RAD * asin (RAD_DEG*M*Z);
    118120      *ra  = alpha + coords[0].crval1;
Note: See TracChangeset for help on using the changeset viewer.