Esempio n. 1
0
File: fk524.c Progetto: phn/pytpm
V6
fk524(V6 v)
{
    v = m6v6(M, v);

    /* restore e-terms */
#ifdef ETERMS
    {
        double m;		/* modulus of position vector */
        V3 s0;
        V3 s1, s1dot;
        V3 r0, r0dot;
        V3 r1, r1dot;

        /* cache the modulus */
        m = v6mod(v);

        /* convert the state vector back to a unit vector */
        v6GetPos(v) = v3scale(v6GetPos(v), 1/m);
        v6GetVel(v) = v3scale(v6GetVel(v), CB/(m*as2r(1)));

        /* now proceed with the standard treatment */
        r1 = v6GetPos(v);
        r1dot = v6GetVel(v);

        s1 = v3unit(r1);

        s0 = s1;
        r0 = v3sum(s1, v3diff(A, v3scale(s0, v3dot(s0, A))));
#ifdef ETERMS_ITERATE
        s0 = v3unit(r0);
        r0 = v3sum(s1, v3diff(A, v3scale(s0, v3dot(s0, A))));
#endif
        v6SetPos(v, r0);

#ifdef ETERMS_VEL
        s1dot = v3scale(r1dot, 1/v3mod(r1));
        r0dot = v3sum(s1dot, v3diff(Adot, v3scale(s0, v3dot(s0, Adot))));
        v6SetVel(v, r0dot);
#endif

        /* convert the unit vector back into a state vector */
        v6GetPos(v) = v3scale(v6GetPos(v), m);
        v6GetVel(v) = v3scale(v6GetVel(v), (m*as2r(1))/CB);
    }
#endif

    return(v);
}
Esempio n. 2
0
V6
ldeflect(V6 s, V6 e, int flag)
{
    double cprime;
    double g1;
    double g2;
    V3 ehat;
    V3 p;
    V3 qhat;
    V3 x;	/* the deflection vector */
    V3 x1;	/* scratch */
    V3 x2;	/* scratch */

    p = v6GetPos(s);

    {
	V6 v6;
	v6 = v6sum(e, s);
	qhat = v3unit(v6GetPos(v6));
    }
    ehat = v3unit(v6GetPos(e));

    cprime = 86400.0 * (IAU_C / IAU_AU);
    g1 = (2.0 * IAU_K * IAU_K) / (cprime * cprime * v6mod(e));
    g2 = 1 + v3dot(qhat, ehat);

    /* limit the value of g2 as Patrick Wallace does:
    ** clip it at 1.0e-5 radians (~922 arcseconds)
    */
    if (g2 < 1.0e-5) {
	g2 = 1.0e-5;
    }

    x1 = v3scale(ehat, v3dot(p, qhat));
    x2 = v3scale(qhat, v3dot(p, ehat));
    x = v3scale(v3diff(x1, x2), g1/g2);

    if (flag > 0) {
	p = v3sum(p, x);
    } else if (flag < 0) {
	p = v3diff(p, x);
    }

    v6SetPos(s, p);

    return(s);
}
Esempio n. 3
0
V6
fk425(V6 v)
{
    /* ensure cartesian vectors */
    v = v6s2c(v);

#ifdef ETERMS
    {
	double m;		/* modulus of position vector */
	V3 u0, u0dot;
	V3 u1, u1dot;

	/* cache the modulus */
	m = v6mod(v);

	/* convert the state vector back to a unit vector */
	v6GetPos(v) = v3scale(v6GetPos(v), 1/m);
	v6GetVel(v) = v3scale(v6GetVel(v), CB/(m*as2r(1)));

	/* now proceed with the standard treatment */
	u0 = v6GetPos(v);
	u1 = v3diff(u0, v3diff(A, v3scale(u0, v3dot(u0, A))));
	v6SetPos(v, u1);

#ifdef ETERMS_VEL
	u0dot = v6GetVel(v);
	u1dot = v3diff(u0dot, v3diff(Adot, v3scale(u0, v3dot(u0, Adot))));
	v6SetVel(v, u1dot);
#endif

	/* convert the unit vector back into a state vector */
	v6GetPos(v) = v3scale(v6GetPos(v), m);
	v6GetVel(v) = v3scale(v6GetVel(v), (m*as2r(1))/CB);
    }
#endif

    v = m6v6(M, v);

    return(v);
}
Esempio n. 4
0
V6
aberrate(V6 p, V6 e, int flag)
{
    double tau;

    tau = v6mod(p) / (IAU_C*(86400/IAU_AU)); 

    /* ensure cartesian vectors */
    p = v6s2c(p);
    e = v6s2c(e);

    if (flag > 0) {
	v6IncX(p, v6GetXDot(e) * tau);
	v6IncY(p, v6GetYDot(e) * tau);
	v6IncZ(p, v6GetZDot(e) * tau);
    } else {
	v6DecX(p, v6GetXDot(e) * tau);
	v6DecY(p, v6GetYDot(e) * tau);
	v6DecZ(p, v6GetZDot(e) * tau);
    }

    return(p);
}