Example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D.

Prototype

public Vector3D(double x, double y, double z) 

Source Link

Document

Simple constructor.

Usage

From source file:org.orekit.forces.radiation.SolarRadiationPressureTest.java

@Test
public void testParameterDerivativeBox() throws OrekitException {

    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06,
            -1.32931592294715829e+04);//from w  w  w  .  j a v  a2 s.  com
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03,
            -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel),
            FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()),
            Constants.EIGEN5C_EARTH_MU));

    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(),
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8,
                    CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));

    checkParameterDerivative(state, forceModel, RadiationSensitive.ABSORPTION_COEFFICIENT, 1.0, 4.0e-16);
    checkParameterDerivative(state, forceModel, RadiationSensitive.REFLECTION_COEFFICIENT, 1.0, 3.0e-15);

}

From source file:org.orekit.forces.SphericalSpacecraftTest.java

@Test
public void testDrag() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00,
            TimeScalesFactory.getTAI());

    // Satellite position as circular parameters
    final double mu = 3.9860047e14;
    final double raan = 270.;
    Orbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.),
            FastMath.toRadians(raan), FastMath.toRadians(5.300 - raan), PositionAngle.MEAN,
            FramesFactory.getEME2000(), date, mu);

    SpacecraftState state = new SpacecraftState(circ);
    double surface = 5.0;
    double cd = 2.0;
    SphericalSpacecraft s = new SphericalSpacecraft(surface, cd, 0.0, 0.0);
    Vector3D relativeVelocity = new Vector3D(36.0, 48.0, 80.0);

    double rho = 0.001;
    Vector3D computedAcceleration = s.dragAcceleration(state.getDate(), state.getFrame(),
            state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), rho,
            relativeVelocity);//from  www .j av  a 2  s  . com
    Vector3D d = relativeVelocity.normalize();
    double v2 = relativeVelocity.getNormSq();
    Vector3D expectedAcceleration = new Vector3D(rho * surface * cd * v2 / (2 * state.getMass()), d);
    Assert.assertEquals(0.0, computedAcceleration.subtract(expectedAcceleration).getNorm(), 1.0e-15);

}

From source file:org.orekit.forces.SphericalSpacecraftTest.java

@Test
public void testRadiationPressure() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2008, 04, 07), TimeComponents.H00,
            TimeScalesFactory.getTAI());

    // Satellite position as circular parameters
    final double mu = 3.9860047e14;
    final double raan = 270.;
    Orbit circ = new CircularOrbit(7178000.0, 0.5e-4, -0.5e-4, FastMath.toRadians(50.),
            FastMath.toRadians(raan), FastMath.toRadians(5.300 - raan), PositionAngle.MEAN,
            FramesFactory.getEME2000(), date, mu);

    SpacecraftState state = new SpacecraftState(circ);
    double surface = 5.0;
    double kA = 0.9;
    double kR = 0.1;
    SphericalSpacecraft s = new SphericalSpacecraft(surface, 0.0, kA, kR);
    Vector3D flux = new Vector3D(36.0, 48.0, 80.0);

    Vector3D computedAcceleration = s.radiationPressureAcceleration(state.getDate(), state.getFrame(),
            state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(), flux);
    Vector3D d = flux.normalize();
    double f = flux.getNorm();
    double p = (1 - kA) * (1 - kR);
    Vector3D expectedAcceleration = new Vector3D(surface * f * (1 + 4 * p / 9) / state.getMass(), d);
    Assert.assertEquals(0.0, computedAcceleration.subtract(expectedAcceleration).getNorm(), 1.0e-15);

}

From source file:org.orekit.frames.EME2000ProviderTest.java

@Test
public void testAASReferenceLEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 04, 06), new TimeComponents(07, 51, 28.386009),
            TimeScalesFactory.getUTC());

    Transform t = FramesFactory.getGCRF().getTransformTo(FramesFactory.getEME2000(), t0);

    PVCoordinates pvGcrfIau2000A = new PVCoordinates(new Vector3D(5102508.9579, 6123011.4038, 6378136.9252),
            new Vector3D(-4743.220156, 790.536497, 5533.755728));
    PVCoordinates pvEME2000EqA = new PVCoordinates(new Vector3D(5102509.0383, 6123011.9758, 6378136.3118),
            new Vector3D(-4743.219766, 790.536344, 5533.756084));
    checkPV(pvEME2000EqA, t.transformPVCoordinates(pvGcrfIau2000A), 1.1e-4, 2.6e-7);

    PVCoordinates pvGcrfIau2000B = new PVCoordinates(new Vector3D(5102508.9579, 6123011.4012, 6378136.9277),
            new Vector3D(-4743.220156, 790.536495, 5533.755729));
    PVCoordinates pvEME2000EqB = new PVCoordinates(new Vector3D(5102509.0383, 6123011.9733, 6378136.3142),
            new Vector3D(-4743.219766, 790.536342, 5533.756085));
    checkPV(pvEME2000EqB, t.transformPVCoordinates(pvGcrfIau2000B), 7.4e-5, 2.6e-7);

}

From source file:org.orekit.frames.EME2000ProviderTest.java

@Test
public void testAASReferenceGEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 06, 01), TimeComponents.H00,
            TimeScalesFactory.getUTC());

    Transform t = FramesFactory.getGCRF().getTransformTo(FramesFactory.getEME2000(), t0);

    PVCoordinates pvGCRFiau2000A = new PVCoordinates(new Vector3D(-40588150.3617, -11462167.0397, 27143.1974),
            new Vector3D(834.787458, -2958.305691, -1.172993));
    PVCoordinates pvEME2000EqA = new PVCoordinates(new Vector3D(-40588149.5482, -11462169.9118, 27146.8462),
            new Vector3D(834.787667, -2958.305632, -1.172963));
    checkPV(pvEME2000EqA, t.transformPVCoordinates(pvGCRFiau2000A), 5.8e-5, 6.4e-7);

    PVCoordinates pvGCRFiau2000B = new PVCoordinates(new Vector3D(-40588150.3617, -11462167.0397, 27143.2125),
            new Vector3D(834.787458, -2958.305691, -1.172999));
    PVCoordinates pvEME2000EqB = new PVCoordinates(new Vector3D(-40588149.5481, -11462169.9118, 27146.8613),
            new Vector3D(834.787667, -2958.305632, -1.172968));
    checkPV(pvEME2000EqB, t.transformPVCoordinates(pvGCRFiau2000B), 1.1e-4, 5.5e-7);

}

From source file:org.orekit.frames.FrameTest.java

@Test
public void testH0m9() throws OrekitException {
    AbsoluteDate h0 = new AbsoluteDate("2010-07-01T10:42:09", TimeScalesFactory.getUTC());
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame rotatingPadFrame = new TopocentricFrame(
            new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING,
                    itrf),/* ww  w.  java 2 s.  c  om*/
            new GeodeticPoint(FastMath.toRadians(5.0), FastMath.toRadians(-100.0), 0.0), "launch pad");

    // create a new inertially oriented frame that is aligned with ITRF2005 at h0 - 9 seconds
    AbsoluteDate h0M9 = h0.shiftedBy(-9.0);
    Frame eme2000 = FramesFactory.getEME2000();
    Frame frozenLaunchFrame = rotatingPadFrame.getFrozenFrame(eme2000, h0M9, "launch frame");

    // check velocity module is unchanged
    Vector3D pEme2000 = new Vector3D(-29536113.0, 30329259.0, -100125.0);
    Vector3D vEme2000 = new Vector3D(-2194.0, -2141.0, -8.0);
    PVCoordinates pvEme2000 = new PVCoordinates(pEme2000, vEme2000);
    PVCoordinates pvH0m9 = eme2000.getTransformTo(frozenLaunchFrame, h0M9).transformPVCoordinates(pvEme2000);
    Assert.assertEquals(vEme2000.getNorm(), pvH0m9.getVelocity().getNorm(), 1.0e-6);

    // this frame is fixed with respect to EME2000 but rotates with respect to the non-frozen one
    // the following loop should have a fixed angle a1 and an evolving angle a2
    double minA1 = Double.POSITIVE_INFINITY;
    double maxA1 = Double.NEGATIVE_INFINITY;
    double minA2 = Double.POSITIVE_INFINITY;
    double maxA2 = Double.NEGATIVE_INFINITY;
    double dt;
    for (dt = 0; dt < 86164; dt += 300.0) {
        AbsoluteDate date = h0M9.shiftedBy(dt);
        double a1 = frozenLaunchFrame.getTransformTo(eme2000, date).getRotation().getAngle();
        double a2 = frozenLaunchFrame.getTransformTo(rotatingPadFrame, date).getRotation().getAngle();
        minA1 = FastMath.min(minA1, a1);
        maxA1 = FastMath.max(maxA1, a1);
        minA2 = FastMath.min(minA2, a2);
        maxA2 = FastMath.max(maxA2, a2);
    }
    Assert.assertEquals(0, maxA1 - minA1, 1.0e-12);
    Assert.assertEquals(FastMath.PI, maxA2 - minA2, 0.01);

}

From source file:org.orekit.frames.FrameTest.java

private Transform randomTransform(Random random) {
    Transform transform = Transform.IDENTITY;
    for (int i = random.nextInt(10); i > 0; --i) {
        if (random.nextBoolean()) {
            Vector3D u = new Vector3D(random.nextDouble() * 1000.0, random.nextDouble() * 1000.0,
                    random.nextDouble() * 1000.0);
            transform = new Transform(transform.getDate(), transform, new Transform(transform.getDate(), u));
        } else {//  ww  w  .  ja v  a 2 s .c o m
            double q0 = random.nextDouble() * 2 - 1;
            double q1 = random.nextDouble() * 2 - 1;
            double q2 = random.nextDouble() * 2 - 1;
            double q3 = random.nextDouble() * 2 - 1;
            double q = FastMath.sqrt(q0 * q0 + q1 * q1 + q2 * q2 + q3 * q3);
            Rotation r = new Rotation(q0 / q, q1 / q, q2 / q, q3 / q, false);
            transform = new Transform(transform.getDate(), transform, new Transform(transform.getDate(), r));
        }
    }
    return transform;
}

From source file:org.orekit.frames.FrameTest.java

private void checkNoTransform(Transform transform, Random random) {
    for (int i = 0; i < 100; ++i) {
        Vector3D a = new Vector3D(random.nextDouble(), random.nextDouble(), random.nextDouble());
        Vector3D b = transform.transformVector(a);
        Assert.assertEquals(0, a.subtract(b).getNorm(), 1.0e-10);
        Vector3D c = transform.transformPosition(a);
        Assert.assertEquals(0, a.subtract(c).getNorm(), 1.0e-10);
    }/*  w w  w.ja v a 2 s  .  c o  m*/
}

From source file:org.orekit.frames.GTODProviderTest.java

@Test
public void testAASReferenceLEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    Utils.setLoaders(IERSConventions.IERS_1996, Utils.buildEOPList(IERSConventions.IERS_1996, new double[][] {
            { 53098, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53099, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53100, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53101, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53102, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53103, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53104, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53105, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN,
                    Double.NaN } }));
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 04, 06), new TimeComponents(07, 51, 28.386009),
            TimeScalesFactory.getUTC());

    // PEF iau76/*from ww  w .  java  2 s  . c om*/
    PVCoordinates pvPEF = new PVCoordinates(new Vector3D(-1033475.0313, 7901305.5856, 6380344.5328),
            new Vector3D(-3225.632747, -2872.442511, 5531.931288));

    // it seems the induced effect of pole nutation correction  on the equation of the equinoxes
    // was not taken into account in the reference paper, so we fix it here for the test
    final double dDeltaPsi = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true)
            .getEquinoxNutationCorrection(t0)[0];
    final double epsilonA = IERSConventions.IERS_1996.getMeanObliquityFunction().value(t0);
    final Transform fix = new Transform(t0, new Rotation(Vector3D.PLUS_K, -dDeltaPsi * FastMath.cos(epsilonA)));

    // TOD iau76
    PVCoordinates pvTOD = new PVCoordinates(new Vector3D(5094514.7804, 6127366.4612, 6380344.5328),
            new Vector3D(-4746.088567, 786.077222, 5531.931288));

    Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true)
            .getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.00942, 3.12e-5);

    // if we forget to apply nutation corrections, results are much worse, which is expected
    t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 257.49, 0.13955);

}

From source file:org.orekit.frames.GTODProviderTest.java

@Test
public void testAASReferenceGEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    Utils.setLoaders(IERSConventions.IERS_1996, Utils.buildEOPList(IERSConventions.IERS_1996, new double[][] {
            { 53153, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53154, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53155, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53156, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53157, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53158, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53159, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53160, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN,
                    Double.NaN } }));
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 06, 01), TimeComponents.H00,
            TimeScalesFactory.getUTC());

    Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true)
            .getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
    // TOD iau76/*from   ww  w . j av a  2s  . c om*/
    PVCoordinates pvTOD = new PVCoordinates(new Vector3D(-40577427.7501, -11500096.1306, 10293.2583),
            new Vector3D(837.552338, -2957.524176, -0.928772));

    // PEF iau76
    PVCoordinates pvPEF = new PVCoordinates(new Vector3D(24796919.2956, -34115870.9001, 10293.2583),
            new Vector3D(-0.979178, -1.476540, -0.928772));

    // it seems the induced effect of pole nutation correction  on the equation of the equinoxes
    // was not taken into account in the reference paper, so we fix it here for the test
    final double dDeltaPsi = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true)
            .getEquinoxNutationCorrection(t0)[0];
    final double epsilonA = IERSConventions.IERS_1996.getMeanObliquityFunction().value(t0);
    final Transform fix = new Transform(t0, new Rotation(Vector3D.PLUS_K, -dDeltaPsi * FastMath.cos(epsilonA)));

    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.0503, 3.59e-4);

    // if we forget to apply nutation corrections, results are much worse, which is expected
    t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 1458.27, 3.847e-4);

}