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

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

Introduction

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

Prototype

Vector3D ZERO

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

Click Source Link

Document

Null vector (coordinates: 0, 0, 0).

Usage

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

/** {@inheritDoc} */
public TimeStampedPVCoordinates projectToGround(final TimeStampedPVCoordinates pv, final Frame frame)
        throws OrekitException {

    // transform point to body frame
    final Transform toBody = frame.getTransformTo(bodyFrame, pv.getDate());
    final TimeStampedPVCoordinates pvInBodyFrame = toBody.transformPVCoordinates(pv);
    final Vector3D p = pvInBodyFrame.getPosition();
    final double r = FastMath.hypot(p.getX(), p.getY());

    // set up the 2D ellipse corresponding to first principal curvature along meridian
    final Vector3D meridian = new Vector3D(p.getX() / r, p.getY() / r, 0);
    final Ellipse firstPrincipalCurvature = new Ellipse(Vector3D.ZERO, meridian, Vector3D.PLUS_K, getA(),
            getC(), bodyFrame);//from  www.  j a  v a 2s  .  co m

    // project coordinates in the meridian plane
    final TimeStampedPVCoordinates gpFirst = firstPrincipalCurvature.projectToEllipse(pvInBodyFrame);
    final Vector3D gpP = gpFirst.getPosition();
    final double gr = MathArrays.linearCombination(gpP.getX(), meridian.getX(), gpP.getY(), meridian.getY());
    final double gz = gpP.getZ();

    // topocentric frame
    final Vector3D east = new Vector3D(-meridian.getY(), meridian.getX(), 0);
    final Vector3D zenith = new Vector3D(gr * getC() / getA(), meridian, gz * getA() / getC(), Vector3D.PLUS_K)
            .normalize();
    final Vector3D north = Vector3D.crossProduct(zenith, east);

    // set up the ellipse corresponding to second principal curvature in the zenith/east plane
    final Ellipse secondPrincipalCurvature = getPlaneSection(gpP, north);
    final TimeStampedPVCoordinates gpSecond = secondPrincipalCurvature.projectToEllipse(pvInBodyFrame);

    final Vector3D gpV = gpFirst.getVelocity().add(gpSecond.getVelocity());
    final Vector3D gpA = gpFirst.getAcceleration().add(gpSecond.getAcceleration());

    // moving projected point
    final TimeStampedPVCoordinates groundPV = new TimeStampedPVCoordinates(pv.getDate(), gpP, gpV, gpA);

    // transform moving projected point back to initial frame
    return toBody.getInverse().transformPVCoordinates(groundPV);

}

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

/** {@inheritDoc} */
public GeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date)
        throws OrekitException {

    // transform point to body frame
    final Vector3D pointInBodyFrame = frame.getTransformTo(bodyFrame, date).transformPosition(point);
    final double r2 = pointInBodyFrame.getX() * pointInBodyFrame.getX()
            + pointInBodyFrame.getY() * pointInBodyFrame.getY();
    final double r = FastMath.sqrt(r2);
    final double z = pointInBodyFrame.getZ();

    // set up the 2D meridian ellipse
    final Ellipse meridian = new Ellipse(Vector3D.ZERO,
            new Vector3D(pointInBodyFrame.getX() / r, pointInBodyFrame.getY() / r, 0), Vector3D.PLUS_K, getA(),
            getC(), bodyFrame);//www  . j a  v a2s  .c om

    // project point on the 2D meridian ellipse
    final Vector2D ellipsePoint = meridian.projectToEllipse(new Vector2D(r, z));

    // relative position of test point with respect to its ellipse sub-point
    final double dr = r - ellipsePoint.getX();
    final double dz = z - ellipsePoint.getY();
    final double insideIfNegative = g2 * (r2 - ae2) + z * z;

    return new GeodeticPoint(FastMath.atan2(ellipsePoint.getY(), g2 * ellipsePoint.getX()),
            FastMath.atan2(pointInBodyFrame.getY(), pointInBodyFrame.getX()),
            FastMath.copySign(FastMath.hypot(dr, dz), insideIfNegative));

}

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

@Test
public void testGroundProjectionPosition() throws OrekitException {
    OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING, FramesFactory.getITRF(IERSConventions.IERS_2010, true));

    TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
    Frame eme2000 = FramesFactory.getEME2000();
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    for (double dt = 0; dt < 3600.0; dt += 60.0) {

        TimeStampedPVCoordinates pv = orbit.getPVCoordinates(orbit.getDate().shiftedBy(dt), eme2000);
        TimeStampedPVCoordinates groundPV = model.projectToGround(pv, eme2000);
        Vector3D groundP = model.projectToGround(pv.getPosition(), pv.getDate(), eme2000);

        // check methods projectToGround and transform are consistent with each other
        Assert.assertEquals(model.transform(pv.getPosition(), eme2000, pv.getDate()).getLatitude(),
                model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLatitude(), 1.0e-10);
        Assert.assertEquals(model.transform(pv.getPosition(), eme2000, pv.getDate()).getLongitude(),
                model.transform(groundPV.getPosition(), eme2000, pv.getDate()).getLongitude(), 1.0e-10);
        Assert.assertEquals(0.0, Vector3D.distance(groundP, groundPV.getPosition()),
                1.0e-15 * groundP.getNorm());

    }//from  w w  w . j av  a  2s . c  om

}

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

@Test
public void testGroundProjectionDerivatives() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    double[] errors = derivativesErrors(orbit, orbit.getDate(), eme2000, model);
    Assert.assertEquals(0, errors[0], 1.0e-16);
    Assert.assertEquals(0, errors[1], 2.0e-12);
    Assert.assertEquals(0, errors[2], 2.0e-4);

}

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

@Test
public void testGroundToGroundIssue181() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
    TimeStampedPVCoordinates body = itrf.getTransformTo(eme2000, initPV.getDate())
            .transformPVCoordinates(initPV);
    TimeStampedPVCoordinates ground1 = model.projectToGround(body, itrf);
    TimeStampedPVCoordinates ground2 = model.projectToGround(ground1, itrf);
    Assert.assertEquals(0.0, Vector3D.distance(ground1.getPosition(), ground2.getPosition()), 1.0e-12);
    Assert.assertEquals(0.0, Vector3D.distance(ground1.getVelocity(), ground2.getVelocity()), 2.0e-12);
    Assert.assertEquals(0.0, Vector3D.distance(ground1.getAcceleration(), ground2.getAcceleration()), 1.0e-12);

}

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

private double[] derivativesErrors(PVCoordinatesProvider provider, AbsoluteDate date, Frame frame,
        OneAxisEllipsoid model) throws OrekitException {
    List<TimeStampedPVCoordinates> pvList = new ArrayList<TimeStampedPVCoordinates>();
    List<TimeStampedPVCoordinates> groundPVList = new ArrayList<TimeStampedPVCoordinates>();
    for (double dt = -0.25; dt <= 0.25; dt += 0.125) {
        TimeStampedPVCoordinates shiftedPV = provider.getPVCoordinates(date.shiftedBy(dt), frame);
        Vector3D p = model.projectToGround(shiftedPV.getPosition(), shiftedPV.getDate(), frame);
        pvList.add(shiftedPV);//from www  . j av a2  s  .  c o m
        groundPVList.add(new TimeStampedPVCoordinates(shiftedPV.getDate(), p, Vector3D.ZERO, Vector3D.ZERO));
    }
    TimeStampedPVCoordinates computed = model.projectToGround(
            TimeStampedPVCoordinates.interpolate(date, CartesianDerivativesFilter.USE_P, pvList), frame);
    TimeStampedPVCoordinates reference = TimeStampedPVCoordinates.interpolate(date,
            CartesianDerivativesFilter.USE_P, groundPVList);

    TimeStampedPVCoordinates pv0 = provider.getPVCoordinates(date, frame);
    Vector3D p0 = pv0.getPosition();
    Vector3D v0 = pv0.getVelocity();
    Vector3D a0 = pv0.getAcceleration();

    return new double[] { Vector3D.distance(computed.getPosition(), reference.getPosition()) / p0.getNorm(),
            Vector3D.distance(computed.getVelocity(), reference.getVelocity()) / v0.getNorm(),
            Vector3D.distance(computed.getAcceleration(), reference.getAcceleration()) / a0.getNorm(), };

}

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

@Test
public void testGroundProjectionTaylor() throws OrekitException {
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame eme2000 = FramesFactory.getEME2000();
    OneAxisEllipsoid model = new OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS,
            Constants.WGS84_EARTH_FLATTENING, itrf);

    TimeStampedPVCoordinates initPV = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH.shiftedBy(584.),
            new Vector3D(3220103., 69623., 6449822.), new Vector3D(6414.7, -2006., -3180.), Vector3D.ZERO);
    Orbit orbit = new EquinoctialOrbit(initPV, eme2000, Constants.EIGEN5C_EARTH_MU);

    TimeStampedPVCoordinates pv0 = orbit.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    PVCoordinatesProvider groundTaylor = model.projectToGround(pv0, model.getBodyFrame())
            .toTaylorProvider(model.getBodyFrame());

    TimeStampedPVCoordinates g0 = groundTaylor.getPVCoordinates(orbit.getDate(), model.getBodyFrame());
    Vector3D zenith = pv0.getPosition().subtract(g0.getPosition()).normalize();
    Vector3D acrossTrack = Vector3D.crossProduct(zenith, g0.getVelocity()).normalize();
    Vector3D alongTrack = Vector3D.crossProduct(acrossTrack, zenith).normalize();
    for (double dt = -1; dt < 1; dt += 0.01) {
        AbsoluteDate date = orbit.getDate().shiftedBy(dt);
        Vector3D taylorP = groundTaylor.getPVCoordinates(date, model.getBodyFrame()).getPosition();
        Vector3D refP = model.projectToGround(orbit.getPVCoordinates(date, model.getBodyFrame()).getPosition(),
                date, model.getBodyFrame());
        Vector3D delta = taylorP.subtract(refP);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, alongTrack), 0.0015);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, acrossTrack), 0.0007);
        Assert.assertEquals(0.0, Vector3D.dotProduct(delta, zenith), 0.00002);
    }/* w  w w . ja  v a2s . c  o  m*/

}

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

@Test
public void geocentricPV() throws OrekitException, ParseException {
    Utils.setDataRoot("regular-data");
    AbsoluteDate date = new AbsoluteDate(1969, 06, 25, TimeScalesFactory.getTDB());
    Frame geocentricFrame = FramesFactory.getGCRF();
    checkPV(CelestialBodyFactory.getMoon(), date, geocentricFrame,
            new Vector3D(-0.0022350411591597575, -0.0010106334699928434, -5.658291803646671E-4),
            new Vector3D(3.1279236468844985E-4, -4.526815459166321E-4, -2.428841016970333E-4));
    checkPV(CelestialBodyFactory.getEarth(), date, geocentricFrame, Vector3D.ZERO, Vector3D.ZERO);
}

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

@Test
public void heliocentricPV() throws OrekitException, ParseException {
    Utils.setDataRoot("regular-data");
    AbsoluteDate date = new AbsoluteDate(1969, 06, 25, TimeScalesFactory.getTDB());
    final Frame gcrf = FramesFactory.getGCRF();
    Frame heliocentricFrame = new Frame(gcrf, new TransformProvider() {
        private static final long serialVersionUID = 1L;

        public Transform getTransform(AbsoluteDate date) throws OrekitException {
            return new Transform(date, CelestialBodyFactory.getSun().getPVCoordinates(date, gcrf).negate());
        }/*  ww w.ja v a2  s .  c o m*/
    }, "heliocentric/aligned GCRF", true);
    checkPV(CelestialBodyFactory.getSun(), date, heliocentricFrame, Vector3D.ZERO, Vector3D.ZERO);
    checkPV(CelestialBodyFactory.getMercury(), date, heliocentricFrame,
            new Vector3D(0.3388866970713254, -0.16350851403469605, -0.12250815624343761),
            new Vector3D(0.008716751907934464, 0.02294287010530833, 0.011349219084264612));
    checkPV(CelestialBodyFactory.getVenus(), date, heliocentricFrame,
            new Vector3D(0.5733328682513444, -0.3947124128748959, -0.21383496742544283),
            new Vector3D(0.012311818929592546, 0.014756722625966128, 0.005857890214695866));
    checkPV(CelestialBodyFactory.getMars(), date, heliocentricFrame,
            new Vector3D(-0.15808000178306866, -1.3285167111540124, -0.6050478023304016),
            new Vector3D(0.014443621048367267, -1.3669889027283553E-4, -4.542404441793112E-4));
    checkPV(CelestialBodyFactory.getJupiter(), date, heliocentricFrame,
            new Vector3D(-5.387442227958154, -0.8116709870422928, -0.21662388956102652),
            new Vector3D(0.0010628473875341506, -0.006527800816267844, -0.0028242250304474767));
    checkPV(CelestialBodyFactory.getSaturn(), date, heliocentricFrame,
            new Vector3D(7.89952834654684, 4.582711147265509, 1.552649660593234),
            new Vector3D(-0.003208403682518813, 0.004335751536569781, 0.001928152129122073));
    checkPV(CelestialBodyFactory.getUranus(), date, heliocentricFrame,
            new Vector3D(-18.2705614311796, -1.151408356279009, -0.24540975062356502),
            new Vector3D(2.1887052624725852E-4, -0.0037678288699642877, -0.0016532828516810242));
    checkPV(CelestialBodyFactory.getNeptune(), date, heliocentricFrame,
            new Vector3D(-16.06747366050193, -23.938436657940095, -9.39837851302005),
            new Vector3D(0.0026425894813251684, -0.0015042632480101307, -6.815738977894145E-4));
    checkPV(CelestialBodyFactory.getPluto(), date, heliocentricFrame,
            new Vector3D(-30.488788499360652, -0.8637991387172488, 8.914537151982762),
            new Vector3D(3.21695873843002E-4, -0.0031487797507673814, -0.0010799339515148705));
}

From source file:org.orekit.files.general.SatelliteTimeCoordinate.java

/** Creates a new {@link SatelliteTimeCoordinate} object with a given epoch
 * and position coordinate. The velocity is set to a zero vector.
 * @param time the epoch of the entry/*from w  w  w.j a  v  a 2 s.c om*/
 * @param pos the position coordinate of the entry
 * @param clock the clock value in (micro-seconds)
 */
public SatelliteTimeCoordinate(final AbsoluteDate time, final Vector3D pos, final double clock) {
    this(time, new PVCoordinates(pos, Vector3D.ZERO), clock, 0.0d);
}