IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 12752 for trunk/Ohana


Ignore:
Timestamp:
Apr 5, 2007, 1:35:33 PM (19 years ago)
Author:
eugene
Message:

calculate projection coordinates for points on back side

File:
1 edited

Legend:

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

    r12724 r12752  
    200200    sphi = cdel*salp;                   /* = cos(theta)*sin(phi) */
    201201    cphi = cdel*sdp*calp - sdel*cdp;    /* = cos(theta)*cos(phi) */
    202     if (stht < 0) return (FALSE);
    203202
    204203    switch (proj) {
    205204      case PROJ_TAN:
    206205      case PROJ_DIS:
    207         *L =  DEG_RAD * sphi / stht;
    208         *M = -DEG_RAD * cphi / stht;
    209         return (TRUE);
     206        Rc = hypot(sphi, cphi);
     207        *L = (stht == 0) ? 180.0 * sphi / Rc :  +DEG_RAD * sphi / stht;
     208        *M = (stht == 0) ? 180.0 * cphi / Rc :  -DEG_RAD * cphi / stht;
     209        return (stht > 0);
    210210      case PROJ_SIN:
    211         *L =  DEG_RAD * sphi;
     211        *L = +DEG_RAD * sphi;
    212212        *M = -DEG_RAD * cphi;
    213         return (TRUE);
     213        return (stht > 0);
    214214      case PROJ_ZEA:
    215215      case PROJ_ZPL:
     
    217217        *L =  Rc * sphi;
    218218        *M = -Rc * cphi;
    219         return (TRUE);
     219        return (stht > 0);
    220220      default:
    221221        return (FALSE);
     
    320320
    321321  status = RD_to_LM (&L, &M, ra, dec, coords);
    322   if (!status) return FALSE;
    323 
    324   status = LM_to_XY (x, y, L, M, coords);
     322
     323  if (finite(L) && finite(M)) {
     324      LM_to_XY (x, y, L, M, coords);
     325  } else {
     326      *x = L;
     327      *y = M;
     328  }
    325329  return (status);
    326330}
Note: See TracChangeset for help on using the changeset viewer.