Search in sources :

Example 61 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class DTM2000 method getDensity.

/**
 * Get the local density.
 * @param date current date
 * @param position current position in frame
 * @param frame the frame in which is defined the position
 * @return local density (kg/m³)
 * @exception OrekitException if date is out of range of solar activity model
 * or if some frame conversion cannot be performed
 */
public double getDensity(final AbsoluteDate date, final Vector3D position, final Frame frame) throws OrekitException {
    // check if data are available :
    if ((date.compareTo(inputParams.getMaxDate()) > 0) || (date.compareTo(inputParams.getMinDate()) < 0)) {
        throw new OrekitException(OrekitMessages.NO_SOLAR_ACTIVITY_AT_DATE, date, inputParams.getMinDate(), inputParams.getMaxDate());
    }
    // compute day number in current year
    final Calendar cal = new GregorianCalendar();
    cal.setTime(date.toDate(TimeScalesFactory.getUTC()));
    final int day = cal.get(Calendar.DAY_OF_YEAR);
    // position in ECEF so we only have to do the transform once
    final Frame ecef = earth.getBodyFrame();
    final Vector3D pEcef = frame.getTransformTo(ecef, date).transformPosition(position);
    // compute geodetic position
    final GeodeticPoint inBody = earth.transform(pEcef, ecef, date);
    final double alti = inBody.getAltitude();
    final double lon = inBody.getLongitude();
    final double lat = inBody.getLatitude();
    // compute local solar time
    final Vector3D sunPos = sun.getPVCoordinates(date, ecef).getPosition();
    final double hl = FastMath.PI + FastMath.atan2(sunPos.getX() * pEcef.getY() - sunPos.getY() * pEcef.getX(), sunPos.getX() * pEcef.getX() + sunPos.getY() * pEcef.getY());
    // get current solar activity data and compute
    return getDensity(day, alti, lon, lat, hl, inputParams.getInstantFlux(date), inputParams.getMeanFlux(date), inputParams.getThreeHourlyKP(date), inputParams.get24HoursKp(date));
}
Also used : Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) GregorianCalendar(java.util.GregorianCalendar) Calendar(java.util.Calendar) GregorianCalendar(java.util.GregorianCalendar) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint)

Example 62 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class JB2008 method getDensity.

/**
 * Get the local density.
 * @param date current date
 * @param position current position in frame
 * @param frame the frame in which is defined the position
 * @return local density (kg/m³)
 * @exception OrekitException if date is out of range of solar activity
 */
public double getDensity(final AbsoluteDate date, final Vector3D position, final Frame frame) throws OrekitException {
    // check if data are available :
    if (date.compareTo(inputParams.getMaxDate()) > 0 || date.compareTo(inputParams.getMinDate()) < 0) {
        throw new OrekitException(OrekitMessages.NO_SOLAR_ACTIVITY_AT_DATE, date, inputParams.getMinDate(), inputParams.getMaxDate());
    }
    // compute MJD date
    final double dateMJD = date.durationFrom(AbsoluteDate.MODIFIED_JULIAN_EPOCH) / Constants.JULIAN_DAY;
    // compute geodetic position
    final GeodeticPoint inBody = earth.transform(position, frame, date);
    // compute sun position
    final Frame ecef = earth.getBodyFrame();
    final Vector3D sunPos = sun.getPVCoordinates(date, ecef).getPosition();
    final GeodeticPoint sunInBody = earth.transform(sunPos, ecef, date);
    return getDensity(dateMJD, sunInBody.getLongitude(), sunInBody.getLatitude(), inBody.getLongitude(), inBody.getLatitude(), inBody.getAltitude(), inputParams.getF10(date), inputParams.getF10B(date), inputParams.getS10(date), inputParams.getS10B(date), inputParams.getXM10(date), inputParams.getXM10B(date), inputParams.getY10(date), inputParams.getY10B(date), inputParams.getDSTDTC(date));
}
Also used : Frame(org.orekit.frames.Frame) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint)

Example 63 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Geoid method transform.

/**
 * {@inheritDoc}
 *
 * @param date date of the conversion. Used for computing frame
 *             transformations and for time dependent geopotential.
 * @return The surface relative point at the same location. Altitude is
 * orthometric height, that is height above the {@link Geoid}. Latitude and
 * longitude are both geodetic and defined with respect to the {@link
 * #getEllipsoid() reference ellipsoid}.
 * @see #transform(GeodeticPoint)
 * @see <a href="http://en.wikipedia.org/wiki/Orthometric_height">Orthometric_height</a>
 */
@Override
public GeodeticPoint transform(final Vector3D point, final Frame frame, final AbsoluteDate date) throws OrekitException {
    // convert using reference ellipsoid, altitude referenced to ellipsoid
    final GeodeticPoint ellipsoidal = this.getEllipsoid().transform(point, frame, date);
    // convert altitude to orthometric using the undulation.
    final double undulation = this.getUndulation(ellipsoidal.getLatitude(), ellipsoidal.getLongitude(), date);
    // add undulation to the altitude
    return new GeodeticPoint(ellipsoidal.getLatitude(), ellipsoidal.getLongitude(), ellipsoidal.getAltitude() - undulation);
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint)

Example 64 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Geoid method transform.

/**
 * {@inheritDoc}
 *
 * @param point The surface relative point to transform. Altitude is
 *              orthometric height, that is height above the {@link Geoid}.
 *              Latitude and longitude are both geodetic and defined with
 *              respect to the {@link #getEllipsoid() reference ellipsoid}.
 * @return point at the same location but as a Cartesian point in the {@link
 * #getBodyFrame() body frame}.
 * @see #transform(Vector3D, Frame, AbsoluteDate)
 */
@Override
public Vector3D transform(final GeodeticPoint point) {
    try {
        // convert orthometric height to height above ellipsoid using undulation
        // TODO pass in date to allow user to specify
        final double undulation = this.getUndulation(point.getLatitude(), point.getLongitude(), this.defaultDate);
        final GeodeticPoint ellipsoidal = new GeodeticPoint(point.getLatitude(), point.getLongitude(), point.getAltitude() + undulation);
        // transform using reference ellipsoid
        return this.getEllipsoid().transform(ellipsoidal);
    } catch (OrekitException e) {
        // an OrekitException, so wrap in an exception we can throw.
        throw new RuntimeException(e);
    }
}
Also used : MathRuntimeException(org.hipparchus.exception.MathRuntimeException) OrekitException(org.orekit.errors.OrekitException) GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint)

Example 65 with GeodeticPoint

use of org.orekit.bodies.GeodeticPoint in project Orekit by CS-SI.

the class Geoid method projectToGround.

@Override
public Vector3D projectToGround(final Vector3D point, final AbsoluteDate date, final Frame frame) throws OrekitException {
    final GeodeticPoint gp = this.transform(point, frame, date);
    final GeodeticPoint gpZero = new GeodeticPoint(gp.getLatitude(), gp.getLongitude(), 0);
    final Transform bodyToFrame = this.getBodyFrame().getTransformTo(frame, date);
    return bodyToFrame.transformPosition(this.transform(gpZero));
}
Also used : GeodeticPoint(org.orekit.bodies.GeodeticPoint) FieldGeodeticPoint(org.orekit.bodies.FieldGeodeticPoint) Transform(org.orekit.frames.Transform) FieldTransform(org.orekit.frames.FieldTransform)

Aggregations

GeodeticPoint (org.orekit.bodies.GeodeticPoint)133 Test (org.junit.Test)78 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)67 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)61 AbsoluteDate (org.orekit.time.AbsoluteDate)45 TopocentricFrame (org.orekit.frames.TopocentricFrame)35 Frame (org.orekit.frames.Frame)34 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)27 SpacecraftState (org.orekit.propagation.SpacecraftState)26 Propagator (org.orekit.propagation.Propagator)24 OrekitException (org.orekit.errors.OrekitException)23 KeplerianPropagator (org.orekit.propagation.analytical.KeplerianPropagator)23 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)22 PVCoordinates (org.orekit.utils.PVCoordinates)20 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)19 BodyShape (org.orekit.bodies.BodyShape)17 Orbit (org.orekit.orbits.Orbit)15 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)13 ArrayList (java.util.ArrayList)12 FieldGeodeticPoint (org.orekit.bodies.FieldGeodeticPoint)12