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.attitudes.LofOffsetPointing.java

/** Compute line of sight intersection with body.
 * @param scToBody transform from spacecraft frame to body frame
 * @return intersection point in body frame (only the position is set!)
 * @exception OrekitException if line of sight does not intersect body
 *///from   ww w  .  j a  va  2 s.c o m
private TimeStampedPVCoordinates losIntersectionWithBody(final Transform scToBody) throws OrekitException {

    // compute satellite pointing axis and position/velocity in body frame
    final Vector3D pointingBodyFrame = scToBody.transformVector(satPointingVector);
    final Vector3D pBodyFrame = scToBody.transformPosition(Vector3D.ZERO);

    // Line from satellite following pointing direction
    // we use arbitrarily the Earth radius as a scaling factor, it could be anything else
    final Line pointingLine = new Line(pBodyFrame,
            pBodyFrame.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, pointingBodyFrame), 1.0e-10);

    // Intersection with body shape
    final GeodeticPoint gpIntersection = shape.getIntersectionPoint(pointingLine, pBodyFrame,
            shape.getBodyFrame(), scToBody.getDate());
    final Vector3D pIntersection = (gpIntersection == null) ? null : shape.transform(gpIntersection);

    // Check there is an intersection and it is not in the reverse pointing direction
    if ((pIntersection == null)
            || (Vector3D.dotProduct(pIntersection.subtract(pBodyFrame), pointingBodyFrame) < 0)) {
        throw new OrekitException(OrekitMessages.ATTITUDE_POINTING_LAW_DOES_NOT_POINT_TO_GROUND);
    }

    return new TimeStampedPVCoordinates(scToBody.getDate(), pIntersection, Vector3D.ZERO, Vector3D.ZERO);

}

From source file:org.orekit.attitudes.NadirPointing.java

/** Compute ground point in nadir direction, in reference frame.
 * @param scRef spacecraft coordinates in reference frame
 * @param refToBody transform from reference frame to body frame
 * @return intersection point in body frame (only the position is set!)
 * @exception OrekitException if line of sight does not intersect body
 *//*from   w w  w  .j av a2s  .c  o m*/
private TimeStampedPVCoordinates nadirRef(final TimeStampedPVCoordinates scRef, final Transform refToBody)
        throws OrekitException {

    final Vector3D satInBodyFrame = refToBody.transformPosition(scRef.getPosition());

    // satellite position in geodetic coordinates
    final GeodeticPoint gpSat = shape.transform(satInBodyFrame, getBodyFrame(), scRef.getDate());

    // nadir position in geodetic coordinates
    final GeodeticPoint gpNadir = new GeodeticPoint(gpSat.getLatitude(), gpSat.getLongitude(), 0.0);

    // nadir point position in body frame
    final Vector3D pNadirBody = shape.transform(gpNadir);

    // nadir point position in reference frame
    final Vector3D pNadirRef = refToBody.getInverse().transformPosition(pNadirBody);

    return new TimeStampedPVCoordinates(scRef.getDate(), pNadirRef, Vector3D.ZERO, Vector3D.ZERO);

}

From source file:org.orekit.attitudes.TargetPointing.java

/** {@inheritDoc} */
@Override/*from  ww w.  j  a  v a  2s .  co  m*/
protected TimeStampedPVCoordinates getTargetPV(final PVCoordinatesProvider pvProv, final AbsoluteDate date,
        final Frame frame) throws OrekitException {
    final Transform t = getBodyFrame().getTransformTo(frame, date);
    final TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(date, target, Vector3D.ZERO,
            Vector3D.ZERO);
    return t.transformPVCoordinates(pv);
}

From source file:org.orekit.attitudes.YawCompensation.java

/** {@inheritDoc} */
@Override//ww w.ja v  a  2s  .c o  m
public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame)
        throws OrekitException {

    final Transform bodyToRef = getBodyFrame().getTransformTo(frame, date);

    // compute sliding target ground point
    final PVCoordinates slidingRef = getTargetPV(pvProv, date, frame);
    final PVCoordinates slidingBody = bodyToRef.getInverse().transformPVCoordinates(slidingRef);

    // compute relative position of sliding ground point with respect to satellite
    final PVCoordinates relativePosition = new PVCoordinates(pvProv.getPVCoordinates(date, frame), slidingRef);

    // compute relative velocity of fixed ground point with respect to sliding ground point
    // the velocity part of the transformPVCoordinates for the sliding point ps
    // from body frame to reference frame is:
    //     d(ps_ref)/dt = r(d(ps_body)/dt + dq/dt) -   ps_ref
    // where r is the rotation part of the transform,  is the corresponding
    // angular rate, and dq/dt is the derivative of the translation part of the
    // transform (the translation itself, without derivative, is hidden in the
    // ps_ref part in the cross product).
    // The sliding point ps is co-located to a fixed ground point pf (i.e. they have the
    // same position at time of computation), but this fixed point as zero velocity
    // with respect to the ground. So the velocity part of the transformPVCoordinates
    // for this fixed point can be computed using the same formula as above:
    // from body frame to reference frame is:
    //     d(pf_ref)/dt = r(0 + dq/dt) -   pf_ref
    // so remembering that the two points are at the same location at computation time,
    // i.e. that at t=0 pf_ref=ps_ref, the relative velocity between the fixed point
    // and the sliding point is given by the simple expression:
    //     d(ps_ref)/dt - d(pf_ref)/dt = r(d(ps_body)/dt)
    // the acceleration is computed by differentiating the expression, which gives:
    //    d(ps_ref)/dt - d(pf_ref)/dt = r(d(ps_body)/dt) -   [d(ps_ref)/dt - d(pf_ref)/dt]
    final Vector3D v = bodyToRef.getRotation().applyTo(slidingBody.getVelocity());
    final Vector3D a = new Vector3D(+1, bodyToRef.getRotation().applyTo(slidingBody.getAcceleration()), -1,
            Vector3D.crossProduct(bodyToRef.getRotationRate(), v));
    final PVCoordinates relativeVelocity = new PVCoordinates(v, a, Vector3D.ZERO);

    final PVCoordinates relativeNormal = PVCoordinates.crossProduct(relativePosition, relativeVelocity)
            .normalize();

    // attitude definition :
    //  . Z satellite axis points to sliding target
    //  . target relative velocity is in (Z,X) plane, in the -X half plane part
    return new Attitude(frame, new TimeStampedAngularCoordinates(date, relativePosition.normalize(),
            relativeNormal.normalize(), PLUS_K, PLUS_J, 1.0e-9));

}

From source file:org.orekit.attitudes.YawCompensationTest.java

/** Test that pointed target motion is along -X sat axis
 *//*from w w  w  . ja  v a 2s. c o m*/
@Test
public void testAlignment() throws OrekitException {

    GroundPointing notCompensated = new NadirPointing(circOrbit.getFrame(), earthShape);
    YawCompensation compensated = new YawCompensation(circOrbit.getFrame(), notCompensated);
    Attitude att0 = compensated.getAttitude(circOrbit, circOrbit.getDate(), circOrbit.getFrame());

    // ground point in satellite Z direction
    Vector3D satInert = circOrbit.getPVCoordinates().getPosition();
    Vector3D zInert = att0.getRotation().applyInverseTo(Vector3D.PLUS_K);
    GeodeticPoint gp = earthShape.getIntersectionPoint(
            new Line(satInert, satInert.add(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, zInert), 1.0e-10),
            satInert, circOrbit.getFrame(), circOrbit.getDate());
    PVCoordinates pEarth = new PVCoordinates(earthShape.transform(gp), Vector3D.ZERO, Vector3D.ZERO);

    double minYWithoutCompensation = Double.POSITIVE_INFINITY;
    double maxYWithoutCompensation = Double.NEGATIVE_INFINITY;
    double minYDotWithoutCompensation = Double.POSITIVE_INFINITY;
    double maxYDotWithoutCompensation = Double.NEGATIVE_INFINITY;
    double minYWithCompensation = Double.POSITIVE_INFINITY;
    double maxYWithCompensation = Double.NEGATIVE_INFINITY;
    double minYDotWithCompensation = Double.POSITIVE_INFINITY;
    double maxYDotWithCompensation = Double.NEGATIVE_INFINITY;
    for (double dt = -0.2; dt < 0.2; dt += 0.002) {

        PVCoordinates withoutCompensation = toSpacecraft(pEarth, circOrbit.shiftedBy(dt), notCompensated);
        if (FastMath.abs(withoutCompensation.getPosition().getX()) <= 1000.0) {
            minYWithoutCompensation = FastMath.min(minYWithoutCompensation,
                    withoutCompensation.getPosition().getY());
            maxYWithoutCompensation = FastMath.max(maxYWithoutCompensation,
                    withoutCompensation.getPosition().getY());
            minYDotWithoutCompensation = FastMath.min(minYDotWithoutCompensation,
                    withoutCompensation.getVelocity().getY());
            maxYDotWithoutCompensation = FastMath.max(maxYDotWithoutCompensation,
                    withoutCompensation.getVelocity().getY());
        }

        PVCoordinates withCompensation = toSpacecraft(pEarth, circOrbit.shiftedBy(dt), compensated);
        if (FastMath.abs(withCompensation.getPosition().getX()) <= 1000.0) {
            minYWithCompensation = FastMath.min(minYWithCompensation, withCompensation.getPosition().getY());
            maxYWithCompensation = FastMath.max(maxYWithCompensation, withCompensation.getPosition().getY());
            minYDotWithCompensation = FastMath.min(minYDotWithCompensation,
                    withCompensation.getVelocity().getY());
            maxYDotWithCompensation = FastMath.max(maxYDotWithCompensation,
                    withCompensation.getVelocity().getY());
        }

    }

    // when the ground point is close to cross the push-broom line (i.e. when x decreases from +1000m to -1000m)
    // it will drift along the Y axis if we don't apply compensation
    // but will remain nearly at y=0 if we do apply compensation
    // in fact, as the yaw compensation mode removes the linear drift,
    // what remains is a parabola y = a ux
    Assert.assertEquals(-55.7056, minYWithoutCompensation, 0.0001);
    Assert.assertEquals(+55.7056, maxYWithoutCompensation, 0.0001);
    Assert.assertEquals(352.5667, minYDotWithoutCompensation, 0.0001);
    Assert.assertEquals(352.5677, maxYDotWithoutCompensation, 0.0001);
    Assert.assertEquals(0.0000, minYWithCompensation, 0.0001);
    Assert.assertEquals(0.0008, maxYWithCompensation, 0.0001);
    Assert.assertEquals(-0.0101, minYDotWithCompensation, 0.0001);
    Assert.assertEquals(0.0102, maxYDotWithCompensation, 0.0001);

}

From source file:org.orekit.attitudes.YawSteering.java

/** Creates a new instance.
 * @param groundPointingLaw ground pointing attitude provider without yaw compensation
 * @param sun sun motion model/*  ww  w. j ava 2  s.c o  m*/
 * @param phasingAxis satellite axis that must be roughly in Sun direction
 * (if solar arrays rotation axis is Y, then this axis should be either +X or -X)
 * @deprecated as of 7.1, replaced with {@link #YawSteering(Frame, GroundPointing, PVCoordinatesProvider, Vector3D)}
 */
@Deprecated
public YawSteering(final GroundPointing groundPointingLaw, final PVCoordinatesProvider sun,
        final Vector3D phasingAxis) {
    super(groundPointingLaw.getBodyFrame());
    this.groundPointingLaw = groundPointingLaw;
    this.sun = sun;
    this.phasingNormal = new PVCoordinates(Vector3D.crossProduct(Vector3D.PLUS_K, phasingAxis).normalize(),
            Vector3D.ZERO, Vector3D.ZERO);
}

From source file:org.orekit.attitudes.YawSteering.java

/** Creates a new instance.
 * @param inertialFrame frame in which orbital velocities are computed
 * @param groundPointingLaw ground pointing attitude provider without yaw compensation
 * @param sun sun motion model// www .  ja  v  a2 s. co m
 * @param phasingAxis satellite axis that must be roughly in Sun direction
 * (if solar arrays rotation axis is Y, then this axis should be either +X or -X)
 * @exception OrekitException if the frame specified is not a pseudo-inertial frame
 * @since 7.1
 */
public YawSteering(final Frame inertialFrame, final GroundPointing groundPointingLaw,
        final PVCoordinatesProvider sun, final Vector3D phasingAxis) throws OrekitException {
    super(inertialFrame, groundPointingLaw.getBodyFrame());
    this.groundPointingLaw = groundPointingLaw;
    this.sun = sun;
    this.phasingNormal = new PVCoordinates(Vector3D.crossProduct(Vector3D.PLUS_K, phasingAxis).normalize(),
            Vector3D.ZERO, Vector3D.ZERO);
}

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

@Test
public void testProjectionDerivatives() throws OrekitException {
    Ellipse e = new Ellipse(Vector3D.ZERO, Vector3D.PLUS_I, Vector3D.PLUS_J, 6.4e6, 6.3e6,
            FramesFactory.getGCRF());/*from ww w  .ja v a  2s  . co m*/
    TimeStampedPVCoordinates linearMotion = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH,
            new Vector3D(7.0e6, 5.0e6, 0.0), new Vector3D(3.0e3, 4.0e3, 0.0), Vector3D.ZERO);
    TimeStampedPVCoordinates g0 = e.projectToEllipse(linearMotion);
    List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
    for (double dt = -0.25; dt <= 0.25; dt += 0.125) {
        sample.add(e.projectToEllipse(linearMotion.shiftedBy(dt)));
    }
    TimeStampedPVCoordinates ref = TimeStampedPVCoordinates.interpolate(g0.getDate(),
            CartesianDerivativesFilter.USE_P, sample);
    Assert.assertEquals(0, Vector3D.distance(g0.getPosition(), ref.getPosition()) / ref.getPosition().getNorm(),
            1.0e-15);
    Assert.assertEquals(0, Vector3D.distance(g0.getVelocity(), ref.getVelocity()) / ref.getVelocity().getNorm(),
            6.0e-12);
    Assert.assertEquals(0,
            Vector3D.distance(g0.getAcceleration(), ref.getAcceleration()) / ref.getAcceleration().getNorm(),
            8.0e-8);

}

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.bodies.OneAxisEllipsoid.java

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

    // transform point to body frame
    final Transform toBody = frame.getTransformTo(bodyFrame, date);
    final Vector3D p = toBody.transformPosition(point);
    final double z = p.getZ();
    final double r = FastMath.hypot(p.getX(), p.getY());

    // set up the 2D meridian ellipse
    final Ellipse meridian = new Ellipse(Vector3D.ZERO, new Vector3D(p.getX() / r, p.getY() / r, 0),
            Vector3D.PLUS_K, getA(), getC(), bodyFrame);

    // find the closest point in the meridian plane
    final Vector3D groundPoint = meridian.toSpace(meridian.projectToEllipse(new Vector2D(r, z)));

    // transform point back to initial frame
    return toBody.getInverse().transformPosition(groundPoint);

}