[Spice_discussion] converting from Earth equator to ecliptic coordinates (was: how accurate is conics?)

Trent Waddington trent.waddington at gmail.com
Fri Sep 3 20:25:12 PDT 2010


On Fri, Sep 3, 2010 at 4:29 PM, Trent Waddington
<trent.waddington at gmail.com> wrote:
> Hmm, that's interesting.  To use the elements provided in the object
> description I need to know how to convert from the heliocentric
> ecliptic reference plane to the inertial reference frame.

To answer my own question, the J2000 frame uses an Earth mean equator
and equinox coordinate system, and Horizons seems to prefer an
ecliptic and equinox coordinate system.  I convert between them with
this code:

    SpiceDouble xform[6][6];
    sxform_c("J2000", "ECLIPJ2000", tdb, xform);
    SpiceDouble ehst[6];
    mxvg_c(xform, hst, 6, 6, ehst);

where hst is the state vectors in J2000 and ehst is the state vectors
in ECLIPJ2000.  This vector can then be converted into a set of
osculating elements suitable for the Horizons user-specified small
body (see http://ssd.jpl.nasa.gov/?horizons_doc#user-specified) using
this code:

    SpiceDouble au;
    SpiceBoolean found;
    gdpool_c("AU", 0, 1, &n, &au, &found);

    SpiceDouble sun_mu;
    SpiceInt n;
    gdpool_c("BODY10_GM", 0, 1, &n, &sun_mu, &found);

#define RTD (180.0 / M_PI)
    SpiceDouble elts[8];
    oscelt_c(ehst, tdb, sun_mu, elts);
    SpiceDouble EC = elts[1];
    SpiceDouble IN = elts[2] * RTD;
    SpiceDouble OM = elts[3] * RTD;
    SpiceDouble  W = elts[4] * RTD;
    SpiceDouble MA = elts[5] * RTD;
    SpiceDouble EPOCH = elts[6] / 24 / 60 / 60 + j2000_c();
    SpiceDouble u = elts[7];
    SpiceDouble A = fabs(u / (2 * (vnorm_c(ehst+3)*vnorm_c(ehst+3)/2 -
u/vnorm_c(ehst)))) / au;
    printf("A=%f; MA=%f; EC=%f; OM=%f; W=%f; IN=%f; EPOCH=%f;\n", A,
MA, EC, OM, W, IN, EPOCH);

Which means I can now smack an asteroid with an impulse and see where it goes.

Does anyone see any problems with this?

Trent

metakernel: http://quantumg.net/metakernel
code: http://quantumg.net/elems.c



More information about the Spice_discussion mailing list