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

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

Introduction

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

Prototype

Vector3D PLUS_J

To view the source code for org.apache.commons.math3.geometry.euclidean.threed Vector3D PLUS_J.

Click Source Link

Document

Second canonical vector (coordinates: 0, 1, 0).

Usage

From source file:org.orekit.bodies.EllipsoidTest.java

@Test
public void testPrincipalPlanesIntersections() {

    final Ellipsoid ellipsoid = new Ellipsoid(FramesFactory.getEME2000(), 1, 2, 3);

    final Ellipse xy = ellipsoid.getPlaneSection(Vector3D.ZERO, Vector3D.PLUS_K);
    Assert.assertEquals(0, Vector3D.distance(Vector3D.ZERO, xy.getCenter()), 1.0e-15);
    checkPrincipalAxes(xy, Vector3D.PLUS_J, Vector3D.MINUS_I);
    Assert.assertEquals(2.0, xy.getA(), 1.0e-15);
    Assert.assertEquals(1.0, xy.getB(), 1.0e-15);
    Assert.assertTrue(xy.getFrame() == ellipsoid.getFrame());
    Assert.assertEquals(0.0, errorOnEllipsoid(xy, ellipsoid), 1.0e-15);
    Assert.assertEquals(0.0, errorOnPlane(xy, Vector3D.ZERO, Vector3D.PLUS_K), 1.0e-15);

    final Ellipse yz = ellipsoid.getPlaneSection(Vector3D.ZERO, Vector3D.PLUS_I);
    Assert.assertEquals(0, Vector3D.distance(Vector3D.ZERO, yz.getCenter()), 1.0e-15);
    checkPrincipalAxes(yz, Vector3D.PLUS_K, Vector3D.MINUS_J);
    Assert.assertEquals(3.0, yz.getA(), 1.0e-15);
    Assert.assertEquals(2.0, yz.getB(), 1.0e-15);
    Assert.assertTrue(yz.getFrame() == ellipsoid.getFrame());
    Assert.assertEquals(0.0, errorOnEllipsoid(yz, ellipsoid), 1.0e-15);
    Assert.assertEquals(0.0, errorOnPlane(yz, Vector3D.ZERO, Vector3D.PLUS_I), 1.0e-15);

    final Ellipse zx = ellipsoid.getPlaneSection(Vector3D.ZERO, Vector3D.PLUS_J);
    Assert.assertEquals(0, Vector3D.distance(Vector3D.ZERO, zx.getCenter()), 1.0e-15);
    checkPrincipalAxes(zx, Vector3D.PLUS_K, Vector3D.PLUS_I);
    Assert.assertEquals(3.0, zx.getA(), 1.0e-15);
    Assert.assertEquals(1.0, zx.getB(), 1.0e-15);
    Assert.assertTrue(zx.getFrame() == ellipsoid.getFrame());
    Assert.assertEquals(0.0, errorOnEllipsoid(zx, ellipsoid), 1.0e-15);
    Assert.assertEquals(0.0, errorOnPlane(zx, Vector3D.ZERO, Vector3D.PLUS_J), 1.0e-15);

}

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

/** Build the surface vectors for body facets of a simple parallelepipedic box.
 * @param xLength length of the body along its X axis (m)
 * @param yLength length of the body along its Y axis (m)
 * @param zLength length of the body along its Z axis (m)
 * @return surface vectors array/*w ww. j a v  a2s. co  m*/
 */
private static Facet[] simpleBoxFacets(final double xLength, final double yLength, final double zLength) {
    return new Facet[] { new Facet(Vector3D.MINUS_I, yLength * zLength),
            new Facet(Vector3D.PLUS_I, yLength * zLength), new Facet(Vector3D.MINUS_J, xLength * zLength),
            new Facet(Vector3D.PLUS_J, xLength * zLength), new Facet(Vector3D.MINUS_K, xLength * yLength),
            new Facet(Vector3D.PLUS_K, xLength * yLength) };
}

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

@Test
public void testBestPointing() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J,
            0.0, 0.0, 0.0);// w  ww .j  ava 2  s  .  co m
    for (double dt = 0; dt < 4000; dt += 60) {

        SpacecraftState state = propagator.propagate(initialDate.shiftedBy(dt));

        Vector3D sunInert = sun.getPVCoordinates(initialDate, state.getFrame()).getPosition();
        Vector3D momentum = state.getPVCoordinates().getMomentum();
        double sunElevation = FastMath.PI / 2 - Vector3D.angle(sunInert, momentum);
        Assert.assertEquals(15.1, FastMath.toDegrees(sunElevation), 0.1);

        Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(),
                state.getAttitude().getRotation());
        Assert.assertEquals(0.0, n.getY(), 1.0e-10);

        // normal misalignment should be entirely due to sun being out of orbital plane
        Vector3D sunSat = state.getAttitude().getRotation().applyTo(sunInert);
        double misAlignment = Vector3D.angle(sunSat, n);
        Assert.assertEquals(sunElevation, misAlignment, 1.0e-3);

    }
}

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

@Test
public void testCorrectFixedRate() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J,
            initialDate, new Vector3D(0.46565509814462996, 0.0, 0.884966287251619),
            propagator.getInitialState().getKeplerianMeanMotion(), 0.0, 0.0, 0.0);

    for (double dt = 0; dt < 4000; dt += 60) {

        SpacecraftState state = propagator.propagate(initialDate.shiftedBy(dt));

        Vector3D sunInert = sun.getPVCoordinates(initialDate, state.getFrame()).getPosition();
        Vector3D momentum = state.getPVCoordinates().getMomentum();
        double sunElevation = FastMath.PI / 2 - Vector3D.angle(sunInert, momentum);
        Assert.assertEquals(15.1, FastMath.toDegrees(sunElevation), 0.1);

        Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(),
                state.getAttitude().getRotation());
        Assert.assertEquals(0.0, n.getY(), 1.0e-10);

        // normal misalignment should be entirely due to sun being out of orbital plane
        Vector3D sunSat = state.getAttitude().getRotation().applyTo(sunInert);
        double misAlignment = Vector3D.angle(sunSat, n);
        Assert.assertEquals(sunElevation, misAlignment, 1.0e-3);

    }//ww w  . j a  va2s .  c om
}

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

@Test
public void testTooSlowFixedRate() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J,
            initialDate, new Vector3D(0.46565509814462996, 0.0, 0.884966287251619),
            0.1 * propagator.getInitialState().getKeplerianMeanMotion(), 0.0, 0.0, 0.0);

    double maxDelta = 0;
    for (double dt = 0; dt < 4000; dt += 60) {

        SpacecraftState state = propagator.propagate(initialDate.shiftedBy(dt));

        Vector3D sunInert = sun.getPVCoordinates(initialDate, state.getFrame()).getPosition();
        Vector3D momentum = state.getPVCoordinates().getMomentum();
        double sunElevation = FastMath.PI / 2 - Vector3D.angle(sunInert, momentum);
        Assert.assertEquals(15.1, FastMath.toDegrees(sunElevation), 0.1);

        Vector3D n = s.getNormal(state.getDate(), state.getFrame(), state.getPVCoordinates().getPosition(),
                state.getAttitude().getRotation());
        Assert.assertEquals(0.0, n.getY(), 1.0e-10);

        // normal misalignment should become very large as solar array rotation is plain wrong
        Vector3D sunSat = state.getAttitude().getRotation().applyTo(sunInert);
        double misAlignment = Vector3D.angle(sunSat, n);
        maxDelta = FastMath.max(maxDelta, FastMath.abs(sunElevation - misAlignment));

    }/* ww  w.j  a va 2s .  c om*/
    Assert.assertTrue(FastMath.toDegrees(maxDelta) > 120.0);

}

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

@Test
public void testWithoutReflection() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(1.5, 3.5, 2.5, sun, 20.0, Vector3D.PLUS_J,
            1.0, 1.0, 0.0);/*from   www.j  av a2 s.  c om*/

    Vector3D earthRot = new Vector3D(0.0, 0.0, 7.292115e-4);
    for (double dt = 0; dt < 4000; dt += 60) {

        AbsoluteDate date = initialDate.shiftedBy(dt);
        SpacecraftState state = propagator.propagate(date);

        // simple Earth fixed atmosphere
        Vector3D p = state.getPVCoordinates().getPosition();
        Vector3D v = state.getPVCoordinates().getVelocity();
        Vector3D vAtm = Vector3D.crossProduct(earthRot, p);
        Vector3D relativeVelocity = vAtm.subtract(v);

        Vector3D drag = s.dragAcceleration(state.getDate(), state.getFrame(),
                state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(),
                0.001, relativeVelocity);
        Assert.assertEquals(0.0, Vector3D.angle(relativeVelocity, drag), 1.0e-10);

        Vector3D sunDirection = sun.getPVCoordinates(date, state.getFrame()).getPosition().normalize();
        Vector3D flux = new Vector3D(-4.56e-6, sunDirection);
        Vector3D radiation = s.radiationPressureAcceleration(state.getDate(), state.getFrame(),
                state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(),
                flux);
        Assert.assertEquals(0.0, Vector3D.angle(flux, radiation), 1.0e-9);

    }

}

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

@Test
public void testPlaneSpecularReflection() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 0.0,
            1.0);// w  w  w  .  j  a  v  a  2 s .  c o  m

    for (double dt = 0; dt < 4000; dt += 60) {

        AbsoluteDate date = initialDate.shiftedBy(dt);
        SpacecraftState state = propagator.propagate(date);

        Vector3D sunDirection = sun.getPVCoordinates(date, state.getFrame()).getPosition().normalize();
        Vector3D flux = new Vector3D(-4.56e-6, sunDirection);
        Vector3D acceleration = s.radiationPressureAcceleration(state.getDate(), state.getFrame(),
                state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(),
                flux);
        Vector3D normal = state.getAttitude().getRotation().applyInverseTo(s.getNormal(state.getDate(),
                state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation()));

        // solar array normal is slightly misaligned with Sun direction due to Sun being out of orbital plane
        Assert.assertEquals(15.1, FastMath.toDegrees(Vector3D.angle(sunDirection, normal)), 0.11);

        // radiation pressure is exactly opposed to solar array normal as there is only specular reflection
        Assert.assertEquals(180.0, FastMath.toDegrees(Vector3D.angle(acceleration, normal)), 1.0e-3);

    }

}

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

@Test
public void testPlaneAbsorption() throws OrekitException {

    AbsoluteDate initialDate = propagator.getInitialState().getDate();
    CelestialBody sun = CelestialBodyFactory.getSun();
    BoxAndSolarArraySpacecraft s = new BoxAndSolarArraySpacecraft(0, 0, 0, sun, 20.0, Vector3D.PLUS_J, 0.0, 1.0,
            0.0);/*w w w  . jav  a  2s  .c om*/

    for (double dt = 0; dt < 4000; dt += 60) {

        AbsoluteDate date = initialDate.shiftedBy(dt);
        SpacecraftState state = propagator.propagate(date);

        Vector3D sunDirection = sun.getPVCoordinates(date, state.getFrame()).getPosition().normalize();
        Vector3D flux = new Vector3D(-4.56e-6, sunDirection);
        Vector3D acceleration = s.radiationPressureAcceleration(state.getDate(), state.getFrame(),
                state.getPVCoordinates().getPosition(), state.getAttitude().getRotation(), state.getMass(),
                flux);
        Vector3D normal = state.getAttitude().getRotation().applyInverseTo(s.getNormal(state.getDate(),
                state.getFrame(), state.getPVCoordinates().getPosition(), state.getAttitude().getRotation()));

        // solar array normal is slightly misaligned with Sun direction due to Sun being out of orbital plane
        Assert.assertEquals(15.1, FastMath.toDegrees(Vector3D.angle(sunDirection, normal)), 0.11);

        // radiation pressure is exactly opposed to Sun direction as there is only absorption
        Assert.assertEquals(180.0, FastMath.toDegrees(Vector3D.angle(acceleration, sunDirection)), 1.0e-3);

    }

}

From source file:org.orekit.forces.drag.DragForceTest.java

@Test
public void testParameterDerivativeBox() throws OrekitException {

    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06,
            -1.32931592294715829e+04);/*www .j  a  va  2s . co m*/
    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));

    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(),
            new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING,
                    FramesFactory.getITRF(IERSConventions.IERS_2010, true))),
            new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J,
                    1.2, 0.7, 0.2));

    checkParameterDerivative(state, forceModel, DragSensitive.DRAG_COEFFICIENT, 1.0e-4, 2.0e-12);

}

From source file:org.orekit.forces.drag.DragForceTest.java

@Test
public void testStateJacobianBox() throws OrekitException {

    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816),
            TimeScalesFactory.getUTC());
    double i = FastMath.toRadians(98.7);
    double omega = FastMath.toRadians(93.0);
    double OMEGA = FastMath.toRadians(15.0 * 22.5);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN,
            FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    OrbitType integrationType = OrbitType.CARTESIAN;
    double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, integrationType);

    NumericalPropagator propagator = new NumericalPropagator(
            new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
    propagator.setOrbitType(integrationType);
    final DragForce forceModel = new DragForce(new HarrisPriester(CelestialBodyFactory.getSun(),
            new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING,
                    FramesFactory.getITRF(IERSConventions.IERS_2010, true))),
            new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8, CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J,
                    1.2, 0.7, 0.2));/*from  www .j  a v  a 2  s.  c o  m*/
    propagator.addForceModel(forceModel);
    SpacecraftState state0 = new SpacecraftState(orbit);

    checkStateJacobian(propagator, state0, date.shiftedBy(3.5 * 3600.0), 1e3, tolerances[0], 2.0e-3);

}