int main (int argc, char **argv) { SpiceDouble et, mat[3][3], mat2[3][3], jac[3][3], nut, obq, dboq; SpiceDouble pos[3], newpos[3]; SpiceDouble lt; SpiceInt planets[6], i; SPICEDOUBLE_CELL (range, 2); SpiceDouble beg,end,stime,etime,*array; char test2[2000]; furnsh_c("/home/barrycarter/BCGIT/ASTRO/standard.tm"); exit(-1); for (i=-20000; i<=20000; i++) { timout_c(year2et(i), "ERAYYYY##-MON-DD HR:MN:SC.############# ::MCAL", 50, test2); printf("TIME: %d %s\n", i, test2); } exit(-1); spkcov_c("/home/barrycarter/SPICE/KERNELS/de431_part-1.bsp", 399, &range); wnfetd_c (&range, 0, &stime, &end); spkcov_c("/home/barrycarter/SPICE/KERNELS/de431_part-2.bsp", 399, &range); wnfetd_c(&range, 0, &beg, &etime); printf("TIMES: %f %f\n", beg, etime); str2et_c("2017-10-17 07:59", &et); printf("ET: %f\n", et); spkezp_c(1, et, "EQEQDATE", "CN+S", 399, pos, <); printf("ET: %f\n", et); printf("POS: %f %f %f %f %f\n", et, pos[0], pos[1], pos[2], lt); // eqeq2eclip(et, mat, jac); mxv_c(mat, pos, newpos); printf("NEWPOS: %f %f %f\n", newpos[0], newpos[1], newpos[2]); exit(0); zzwahr_(&et, &nut); zzmobliq_(&et, &obq, &dboq); printf("NUTATION: %f\n", nut); printf("OBLIQUITY: %f\n", obq); pxform_c("EQEQDATE", "ECLIPDATE", et, mat); for (i=0; i<=2; i++) { printf("ALPHA: %d %f %f %f\n", i, mat[i][0], mat[i][1], mat[i][2]); } eqeq2eclip(et, mat2); printf("ALPHATEST\n"); for (i=0; i<=2; i++) { printf("BETA: %d %f %f %f\n", i, mat2[i][0], mat2[i][1], mat2[i][2]); } exit(0); str2et_c("10400-FEB-28 00:00:00", &et); printf("ET: %f\n", et); str2et_c("10400-MAR-01 00:00:00", &et); printf("ET: %f\n", et); exit(0); timout_c(0, "ERAYYYY##-MON-DD HR:MN:SC.############# ::MCAL", 41, test2); printf("%s\n", test2); exit(0); long long test = -pow(2,63); printf("TEST: %lld\n",test); exit(0); if (!strcmp(argv[1],"posxyz")) { double time = atof(argv[2]); int planet = atoi(argv[3]); posxyz(time,planet,pos); printf("%f -> %f %f %f\n",time,pos[0],pos[1],pos[2]); }; if (!strcmp(argv[1],"earthvector")) { double time = atof(argv[2]); int planet = atoi(argv[3]); earthvector(time,planet,pos); printf("%f -> %f %f %f\n",time,pos[0],pos[1],pos[2]); }; if (!strcmp(argv[1],"earthangle")) { double time = atof(argv[2]); int p1 = atoi(argv[3]); int p2 = atoi(argv[4]); SpiceDouble sep = earthangle(time,p1,p2); printf("%f -> %f\n",time,sep); }; if (!strcmp(argv[1],"earthmaxangle")) { double time = atof(argv[2]); for (i=3; i<argc; i++) {planets[i-3] = atoi(argv[i]);} SpiceDouble sep = earthmaxangle(time,argc-3,planets); printf("%f -> %f\n",time,sep); }; }
/* $Procedure ZZENUT80 ( Earth nutation transformation, IAU 1980 model ) */ /* Subroutine */ int zzenut80_(doublereal *et, doublereal *nutxf) { doublereal dmob; extern /* Subroutine */ int zzmobliq_(doublereal *, doublereal *, doublereal *), chkin_(char *, ftnlen); doublereal dvnut[4]; extern /* Subroutine */ int eul2xf_(doublereal *, integer *, integer *, integer *, doublereal *); doublereal eulang[6]; extern /* Subroutine */ int chkout_(char *, ftnlen); extern logical return_(void); extern /* Subroutine */ int zzwahr_(doublereal *, doublereal *); doublereal mob; /* $ Abstract */ /* SPICE Private routine intended solely for the support of SPICE */ /* routines. Users should not call this routine directly due */ /* to the volatile nature of this routine. */ /* Compute the state transformation matrix implementing the IAU 1980 */ /* nutation model. */ /* $ Disclaimer */ /* THIS SOFTWARE AND ANY RELATED MATERIALS WERE CREATED BY THE */ /* CALIFORNIA INSTITUTE OF TECHNOLOGY (CALTECH) UNDER A U.S. */ /* GOVERNMENT CONTRACT WITH THE NATIONAL AERONAUTICS AND SPACE */ /* ADMINISTRATION (NASA). THE SOFTWARE IS TECHNOLOGY AND SOFTWARE */ /* PUBLICLY AVAILABLE UNDER U.S. EXPORT LAWS AND IS PROVIDED "AS-IS" */ /* TO THE RECIPIENT WITHOUT WARRANTY OF ANY KIND, INCLUDING ANY */ /* WARRANTIES OF PERFORMANCE OR MERCHANTABILITY OR FITNESS FOR A */ /* PARTICULAR USE OR PURPOSE (AS SET FORTH IN UNITED STATES UCC */ /* SECTIONS 2312-2313) OR FOR ANY PURPOSE WHATSOEVER, FOR THE */ /* SOFTWARE AND RELATED MATERIALS, HOWEVER USED. */ /* IN NO EVENT SHALL CALTECH, ITS JET PROPULSION LABORATORY, OR NASA */ /* BE LIABLE FOR ANY DAMAGES AND/OR COSTS, INCLUDING, BUT NOT */ /* LIMITED TO, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, */ /* INCLUDING ECONOMIC DAMAGE OR INJURY TO PROPERTY AND LOST PROFITS, */ /* REGARDLESS OF WHETHER CALTECH, JPL, OR NASA BE ADVISED, HAVE */ /* REASON TO KNOW, OR, IN FACT, SHALL KNOW OF THE POSSIBILITY. */ /* RECIPIENT BEARS ALL RISK RELATING TO QUALITY AND PERFORMANCE OF */ /* THE SOFTWARE AND ANY RELATED MATERIALS, AND AGREES TO INDEMNIFY */ /* CALTECH AND NASA FOR ALL THIRD-PARTY CLAIMS RESULTING FROM THE */ /* ACTIONS OF RECIPIENT IN THE USE OF THE SOFTWARE. */ /* $ Required_Reading */ /* None. */ /* $ Keywords */ /* FRAMES */ /* MATRIX */ /* PRIVATE */ /* TRANSFORMATION */ /* UTILITY */ /* $ Declarations */ /* $ Brief_I/O */ /* VARIABLE I/O DESCRIPTION */ /* -------- --- ------------------------------------------------- */ /* ET I Ephemeris time, seconds past J2000. */ /* NUTXF O Nutation transformation matrix. */ /* $ Detailed_Input */ /* ET is an epoch, expressed as seconds past J2000 TDB. */ /* $ Detailed_Output */ /* NUTXF is a state transformation matrix that maps states */ /* from the earth mean equator and equinox of date */ /* frame (based on the 1976 IAU precession model) to */ /* the earth true equator and equinox frame of date */ /* (based on the 1980 IAU nutation model). */ /* $ Parameters */ /* None. */ /* $ Exceptions */ /* Error free. */ /* $ Files */ /* None. */ /* $ Particulars */ /* See the private SPICELIB routine ZZWAHR for a discussion */ /* of the implementation of the 1980 IAU nutation model. */ /* See the private SPICELIB routine ZZMOBLIQ for a discussion */ /* of the implementation of the 1980 IAU earth mean obliquity */ /* of date model. */ /* $ Examples */ /* See ZZDYNFRM. */ /* $ Restrictions */ /* 1) This is a SPICE private routine; the routine is subject */ /* to change without notice. User applications should not */ /* call this routine. */ /* $ Author_and_Institution */ /* N.J. Bachman (JPL) */ /* $ Literature_References */ /* [1] "Explanatory Supplement to the Astronomical Almanac" */ /* edited by P. Kenneth Seidelmann. University Science */ /* Books, 20 Edgehill Road, Mill Valley, CA 94941 (1992) */ /* [2] "Section 5, Geocentric Space-Fixed Position, Velocity, and */ /* Acceleration Vectors of Tracking Station" by T. D. Moyer. */ /* Draft of JPL Publication documenting the JPL navigation */ /* program "Regres." */ /* $ Version */ /* - SPICELIB Version 1.0.0, 18-DEC-2004 (NJB) */ /* -& */ /* SPICELIB functions */ /* Local variables */ if (return_()) { return 0; } chkin_("ZZENUT80", (ftnlen)8); /* Get nutation angles and their rates. We're expecting */ /* DVNUT(1) = Psi------nutation in longitude (radians) */ /* DVNUT(2) = Epsilon--nutation in obliquity (radians) */ /* DVNUT(3) = dPsi/dt (radians/second) */ /* DVNUT(4) = dEpsilon/dt (radians/second) */ zzwahr_(et, dvnut); /* Get the mean obliquity of date. */ /* We're expecting the outputs to be as follows: */ /* MOB is the mean obliquity of the ecliptic at epoch */ /* ET. The mean obliquity of the ecliptic is the */ /* inclination of the ecliptic of date to the */ /* mean Earth equator of date. Output units are */ /* radians. */ /* DMOB is the time derivative of MOB at ET, expressed */ /* in radians per second. */ zzmobliq_(et, &mob, &dmob); /* The nutation rotation N is defined by */ /* N = [ -MOB - NUOBL ] [ -NULON ] [ MOB ] */ /* 1 3 1 */ /* where MOBLIQ is the mean obliquity of the earth's ecliptic */ /* at epoch, NUOB is nutation in obliquity at epoch, and */ /* NULONG is nutation in longitude at epoch. Using our */ /* variable names, the Euler angle sequence is */ /* [ -MOB - DVNUT(2) ] [ -DVNUT(1) ] [ MOB ] */ /* 1 3 1 */ /* The rates corresponding to these angles are: */ /* -DMOB - DVNUT(4), -DVNUT(3), DMOB */ /* We can use EUL2XF to form the state transformation from */ /* the nutation base frame to the nutation frame. */ eulang[0] = -mob - dvnut[1]; eulang[1] = -dvnut[0]; eulang[2] = mob; eulang[3] = -dmob - dvnut[3]; eulang[4] = -dvnut[2]; eulang[5] = dmob; eul2xf_(eulang, &c__1, &c__3, &c__1, nutxf); chkout_("ZZENUT80", (ftnlen)8); return 0; } /* zzenut80_ */