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 a, Vector3D u) 

Source Link

Document

Multiplicative constructor Build a vector from another one and a scale factor.

Usage

From source file:org.orekit.orbits.Orbit.java

/** Set the orbit from Cartesian parameters.
 *
 * <p> The acceleration provided in {@code pvCoordinates} is accessible using
 * {@link #getPVCoordinates()} and {@link #getPVCoordinates(Frame)}. All other methods
 * use {@code mu} and the position to compute the acceleration, including
 * {@link #shiftedBy(double)} and {@link #getPVCoordinates(AbsoluteDate, Frame)}.
 *
 * @param pvCoordinates the position and velocity in the inertial frame
 * @param frame the frame in which the {@link TimeStampedPVCoordinates} are defined
 * (<em>must</em> be a {@link Frame#isPseudoInertial pseudo-inertial frame})
 * @param mu central attraction coefficient (m^3/s^2)
 * @exception IllegalArgumentException if frame is not a {@link
 * Frame#isPseudoInertial pseudo-inertial frame}
 *//*  w ww .j av a  2 s .  com*/
protected Orbit(final TimeStampedPVCoordinates pvCoordinates, final Frame frame, final double mu)
        throws IllegalArgumentException {
    ensurePseudoInertialFrame(frame);
    this.date = pvCoordinates.getDate();
    this.mu = mu;
    if (pvCoordinates.getAcceleration().getNormSq() == 0) {
        // the acceleration was not provided,
        // compute it from Newtonian attraction
        final double r2 = pvCoordinates.getPosition().getNormSq();
        final double r3 = r2 * FastMath.sqrt(r2);
        this.pvCoordinates = new TimeStampedPVCoordinates(pvCoordinates.getDate(), pvCoordinates.getPosition(),
                pvCoordinates.getVelocity(), new Vector3D(-mu / r3, pvCoordinates.getPosition()));
    } else {
        this.pvCoordinates = pvCoordinates;
    }
    this.frame = frame;
}