IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 8130


Ignore:
Timestamp:
Aug 4, 2006, 2:23:10 AM (20 years ago)
Author:
eugene
Message:

add scalar conversion option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/csystem.c

    r7917 r8130  
    55  /* USAGE: csystem [C/G/E/H] [C/G/E/H] [epoch] */
    66  int i;
    7   double X, Y, Xo, xo, phi, T;
     7  double Xin, Yin, X, Y, Xo, xo, phi, T;
    88  double sin_x, sin_y, cos_x, cos_y;
    99  float *x, *y;
     
    8686  Xo *= RAD_DEG;
    8787
     88  if (SelectScalar (argv[3], &X)) {
     89      if (!SelectScalar (argv[4], &Y)) return (FALSE);
     90     
     91      X *= RAD_DEG;
     92      Y *= RAD_DEG;
     93
     94      sin_y = cos(Y)*sin(X - Xo)*sin(phi) + sin(Y)*cos(phi);
     95      cos_y = sqrt (1 - sin_y*sin_y);
     96      sin_x = (cos(Y)*sin(X - Xo)*cos(phi) - sin(Y)*sin(phi)) /  cos_y;
     97      cos_x = cos(Y)*cos(X - Xo) / cos_y;
     98     
     99      X = (DEG_RAD * atan2 (sin_x, cos_x) + xo + 360);
     100     
     101      while (X >= 360.0)
     102          X -= 360;
     103      Y = DEG_RAD * atan2 (sin_y, cos_y);
     104
     105      gprint (GP_LOG, "%10.6f %10.6f\n", X, Y);
     106      return (TRUE);
     107  }
     108
    88109  /* find vectors */
    89110  if ((xvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE);
Note: See TracChangeset for help on using the changeset viewer.