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));
}
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));
}
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);
}
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);
}
}
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));
}
Aggregations