Astro-PAL

 view release on metacpan or  search on metacpan

erfasrc/src/fk524.c  view on Meta::CPAN

**     Aoki, S. et al., 1983, "Conversion matrix of epoch B1950.0
**     FK4-based positions of stars to epoch J2000.0 positions in
**     accordance with the new IAU resolutions".  Astron.Astrophys.
**     128, 263-267.
**
**     Seidelmann, P.K. (ed), 1992, "Explanatory Supplement to the
**     Astronomical Almanac", ISBN 0-935702-68-7.
**
**     Smith, C.A. et al., 1989, "The transformation of astrometric
**     catalog systems to the equinox J2000.0".  Astron.J. 97, 265.
**
**     Standish, E.M., 1982, "Conversion of positions and proper motions
**     from B1950.0 to the IAU system at J2000.0".  Astron.Astrophys.,
**     115, 1, 20-22.
**
**     Yallop, B.D. et al., 1989, "Transformation of mean star places
**     from FK4 B1950.0 to FK5 J2000.0 using matrices in 6-space".
**     Astron.J. 97, 274.
**
**  Copyright (C) 2013-2020, NumFOCUS Foundation.
**  Derived, with permission, from the SOFA library.  See notes at end of file.
*/
{
/* Radians per year to arcsec per century */
   const double PMF = 100.0*ERFA_DR2AS;

/* Small number to avoid arithmetic problems */
   const double TINY = 1e-30;

/* Miscellaneous */
   double r, d, ur, ud, px, rv, pxvf, w, rd;
   int i, j, k, l;

/* Vectors, p and pv */
   double r0[2][3], r1[2][3], p1[3], p2[3], pv[2][3];

/*
** CANONICAL CONSTANTS (Seidelmann 1992)
*/

/* Km per sec to AU per tropical century */
/* = 86400 * 36524.2198782 / 149597870.7 */
   const double VF = 21.095;

/* Constant pv-vector (cf. Seidelmann 3.591-2, vectors A and Adot) */
   static double a[2][3] = {
                      { -1.62557e-6, -0.31919e-6, -0.13843e-6 },
                      { +1.245e-3,   -1.580e-3,   -0.659e-3   }
                           };

/* 3x2 matrix of pv-vectors (cf. Seidelmann 3.592-1, matrix M^-1) */
   static double em[2][3][2][3] = {

    { { { +0.9999256795,     +0.0111814828,     +0.0048590039,    },
        { -0.00000242389840, -0.00000002710544, -0.00000001177742 } },

      { { -0.0111814828,     +0.9999374849,     -0.0000271771,    },
        { +0.00000002710544, -0.00000242392702, +0.00000000006585 } },

      { { -0.0048590040,     -0.0000271557,     +0.9999881946,    },
        { +0.00000001177742, +0.00000000006585, -0.00000242404995 } } },

    { { { -0.000551,         +0.238509,         -0.435614,        },
        { +0.99990432,       +0.01118145,       +0.00485852       } },

      { { -0.238560,         -0.002667,         +0.012254,        },
        { -0.01118145,       +0.99991613,       -0.00002717       } },

      { { +0.435730,         -0.008541,         +0.002117,        },
        { -0.00485852,       -0.00002716,       +0.99996684       } } }

                                  };

/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* The FK5 data (units radians and arcsec per Julian century). */
   r = r2000;
   d = d2000;
   ur = dr2000*PMF;
   ud = dd2000*PMF;
   px = p2000;
   rv = v2000;

/* Express as a pv-vector. */
   pxvf = px * VF;
   w = rv * pxvf;
   eraS2pv(r, d, 1.0, ur, ud, w, r0);

/* Convert pv-vector to Bessel-Newcomb system (cf. Seidelmann 3.592-1). */
   for ( i = 0; i < 2; i++ ) {
      for ( j = 0; j < 3; j++ ) {
         w = 0.0;
         for ( k = 0; k < 2; k++ ) {
            for ( l = 0; l < 3; l++ ) {
               w += em[i][j][k][l] * r0[k][l];
            }
         }
         r1[i][j] = w;
      }
   }

/* Apply E-terms (equivalent to Seidelmann 3.592-3, one iteration). */

/* Direction. */
   w = eraPm(r1[0]);
   eraSxp(eraPdp(r1[0],a[0]), r1[0], p1);
   eraSxp(w, a[0], p2);
   eraPmp(p2, p1, p1);
   eraPpp(r1[0], p1, p1);

/* Recompute length. */
   w = eraPm(p1);

/* Direction. */
   eraSxp(eraPdp(r1[0],a[0]), r1[0], p1);
   eraSxp(w, a[0], p2);
   eraPmp(p2, p1, p1);
   eraPpp(r1[0], p1, pv[0]);

/* Derivative. */
   eraSxp(eraPdp(r1[0],a[1]), pv[0], p1);



( run in 1.425 second using v1.01-cache-2.11-cpan-39bf76dae61 )