IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 14288


Ignore:
Timestamp:
Jul 18, 2007, 8:47:53 AM (19 years ago)
Author:
eugene
Message:

adding ARC projection, fixing STG, adding some comments

File:
1 edited

Legend:

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

    r12752 r14288  
    7272      case PROJ_TAN:
    7373      case PROJ_DIS:
     74        // R = cot (theta) = cos(theta) / sin(theta)
    7475        if (R == 0) {
    7576          stht = 1.0;
     
    8283        break;
    8384      case PROJ_STG:
     85        // R = (180/pi) [2 cos (theta)  / 1 + sin (theta)]
    8486        stht = (4 - RAD_DEG*R) / (4 + RAD_DEG*R);
    8587        ctht = sqrt (1 - stht*stht);
    8688        break;
    8789      case PROJ_SIN:
     90        // R = (180/pi) cos (theta)
    8891        ctht = RAD_DEG * R;
    8992        stht = sqrt (1 - ctht*ctht);
     93        break;
     94      case PROJ_ARC:
     95        // R = 90 - theta (degrees)
     96        ctht = sin (RAD_DEG * R);
     97        stht = cos (RAD_DEG * R);
    9098        break;
    9199      case PROJ_ZEA:
     
    161169  double phi, theta;
    162170  double Lo, Mo;
    163   double sphi, cphi, stht;
     171  double sphi, cphi, stht, ctht;
    164172  double salp, calp, sdel, cdel, sdp, cdp;
    165173  double P, A, Rc;
     
    201209    cphi = cdel*sdp*calp - sdel*cdp;    /* = cos(theta)*cos(phi) */
    202210
     211    // L = +R sin(phi)
     212    // M = -R cos(phi)
     213
    203214    switch (proj) {
    204215      case PROJ_TAN:
    205216      case PROJ_DIS:
     217        // R = cot (theta) = cos(theta) / sin(theta)
    206218        Rc = hypot(sphi, cphi);
    207219        *L = (stht == 0) ? 180.0 * sphi / Rc :  +DEG_RAD * sphi / stht;
    208220        *M = (stht == 0) ? 180.0 * cphi / Rc :  -DEG_RAD * cphi / stht;
    209221        return (stht > 0);
     222      case PROJ_STG:
     223        // R = 2 cos(theta) / [1 + sin(theta)]
     224        Rc = DEG_RAD * 2 / (1 + stht);
     225        *L = +Rc * sphi;
     226        *M = -Rc * cphi;
     227        return (stht > 0);
    210228      case PROJ_SIN:
     229        // R = cos(theta)
    211230        *L = +DEG_RAD * sphi;
    212231        *M = -DEG_RAD * cphi;
    213232        return (stht > 0);
     233      case PROJ_ARC:
     234        // R = 90 - theta
     235        ctht = hypot(sphi, cphi);
     236        theta = atan2 (stht, ctht);
     237        Rc = 90 - DEG_RAD * theta;
     238        *L = (ctht == 0.0) ? 0.0 : +Rc * sphi / ctht ;
     239        *M = (ctht == 0.0) ? 0.0 : -Rc * cphi / ctht ;
     240        return (TRUE);
    214241      case PROJ_ZEA:
    215242      case PROJ_ZPL:
     243        // R = 90 - theta
    216244        Rc = DEG_RAD * M_SQRT2 / sqrt (1 + stht);
    217245        *L =  Rc * sphi;
Note: See TracChangeset for help on using the changeset viewer.