45 #include "FGJSBBase.h" 46 #include "FGColumnVector3.h" 47 #include "FGMatrix33.h" 48 #include "input_output/FGGroundCallback.h" 54 #define ID_LOCATION "$Id: FGLocation.h,v 1.35 2015/09/20 20:53:13 bcoconni Exp $" 171 FGLocation(
double lon,
double lat,
double radius);
223 void SetPosition(
double lon,
double lat,
double radius);
234 void SetEllipse(
double semimajor,
double semiminor);
304 double cLat = mTec2l(1,3);
308 return -mTec2l(3,3)/cLat;
323 double GetRadius()
const { ComputeDerived();
return mRadius; }
348 { ComputeDerived();
return GroundCallback->GetSeaLevelRadius(*
this); }
354 { ComputeDerived();
return GroundCallback->GetTerrainGeoCentRadius(*
this); }
360 { ComputeDerived();
return GroundCallback->GetAltitude(*
this); }
380 { ComputeDerived();
return GroundCallback->GetAGLevel(*
this, contact, normal, v, w); }
450 double GetDistanceTo(
double target_longitude,
double target_latitude)
const;
459 double GetHeadingTo(
double target_longitude,
double target_latitude)
const;
468 ComputeDerived();
return mTl2ec*lvec + mECLoc;
478 ComputeDerived();
return mTec2l*(ecvec - mECLoc);
495 double&
operator()(
unsigned int idx) { mCacheValid =
false;
return mECLoc.
Entry(idx); }
505 double Entry(
unsigned int idx)
const {
return mECLoc.
Entry(idx); }
516 mCacheValid =
false;
return mECLoc.
Entry(idx);
543 return mECLoc == l.mECLoc;
619 void ComputeDerivedUnconditional(
void)
const;
625 void ComputeDerived(
void)
const {
627 ComputeDerivedUnconditional();
644 mutable double mRadius;
645 mutable double mGeodLat;
646 mutable double GeodeticAltitude;
671 mutable bool mCacheValid;
674 static FGGroundCallback_ptr GroundCallback;
685 return l.operator*(scalar);
bool operator==(const FGLocation &l) const
This operator returns true if the ECEF location vectors for the two location objects are equal...
static void SetGroundCallback(FGGroundCallback *gc)
Sets the ground callback pointer.
void SetPosition(double lon, double lat, double radius)
Sets the longitude, latitude and the distance from the center of the earth.
const FGLocation & operator*=(double scalar)
This operator scales the ECEF position vector.
void SetLongitude(double longitude)
Set the longitude.
double GetSeaLevelRadius(void) const
Get the local sea level radius.
void SetLatitude(double latitude)
Set the latitude.
double GetAltitudeASL(void) const
Get the altitude above sea level.
void SetAltitudeAGL(double altitudeAGL)
Set the altitude above ground level.
void SetRadius(double radius)
Set the distance from the center of the earth.
double GetGeodAltitude(void) const
Gets the geodetic altitude in feet.
double GetSinLatitude() const
Get the sine of Latitude.
double GetGeodLatitudeDeg(void) const
Get the geodetic latitude in degrees.
double GetDistanceTo(double target_longitude, double target_latitude) const
Get the geodetic distance between the current location and a given location.
double GetLatitude() const
Get the latitude.
This class provides callback slots to get ground specific data.
FGLocation holds an arbitrary location in the Earth centered Earth fixed reference frame (ECEF)...
FGColumnVector3 LocationToLocal(const FGColumnVector3 &ecvec) const
Conversion from a location in the earth centered and fixed frame to local horizontal frame coordinate...
FGLocation operator+(const FGLocation &l) const
This operator adds two ECEF position vectors.
double GetContactPoint(FGLocation &contact, FGColumnVector3 &normal, FGColumnVector3 &v, FGColumnVector3 &w) const
Get terrain contact point information below the current location.
double GetCosLongitude() const
Get the cosine of Longitude.
FGLocation operator*(double scalar) const
This operator scales an ECEF position vector.
void SetPositionGeodetic(double lon, double lat, double height)
Sets the longitude, latitude and the distance above the reference ellipsoid.
double GetEPA() const
Return the Earth Position Angle.
void SetEarthPositionAngle(double EPA)
Sets the Earth position angle.
double GetRadius() const
Get the distance from the center of the earth.
void SetEllipse(double semimajor, double semiminor)
Sets the semimajor and semiminor axis lengths for this planet.
double Entry(unsigned int idx) const
Read access the entries of the vector.
const FGLocation & operator=(const FGColumnVector3 &v)
Sets this location via the supplied vector.
const FGMatrix33 & GetTi2ec(void) const
Transform matrix from inertial to earth centered frame.
double GetLongitude() const
Get the longitude.
double & Entry(unsigned int idx)
Write access the entries of the vector.
void SetAltitudeASL(double altitudeASL)
Set the altitude above sea level.
const FGLocation & operator/=(double scalar)
This operator scales the ECEF position vector.
double GetTanLatitude() const
Get the cosine of Latitude.
double Entry(const unsigned int idx) const
Read access the entries of the vector.
FGLocation LocalToLocation(const FGColumnVector3 &lvec) const
Conversion from Local frame coordinates to a location in the earth centered and fixed frame...
double GetHeadingTo(double target_longitude, double target_latitude) const
Get the heading that should be followed from the current location to a given location along the short...
double GetTerrainRadius(void) const
Get the local terrain radius.
const FGLocation & operator+=(const FGLocation &l)
This operator adds the ECEF position vectors.
const FGMatrix33 & GetTl2i(void) const
Transform matrix from local horizontal to inertial frame.
FGLocation(void)
Default constructor.
This class implements a 3 element column vector.
double operator()(unsigned int idx) const
Read access the entries of the vector.
double GetSinLongitude() const
Get the sine of Longitude.
double GetGeodLatitudeRad(void) const
Get the geodetic latitude.
double GetLongitudeDeg() const
Get the longitude.
double GetCosLatitude() const
Get the cosine of Latitude.
const FGMatrix33 & GetTec2l(void) const
Transform matrix from the earth centered to local horizontal frame.
Handles matrix math operations.
double GetLatitudeDeg() const
Get the latitude.
FGLocation operator-(const FGLocation &l) const
This operator substracts two ECEF position vectors.
static FGGroundCallback * GetGroundCallback(void)
Get a pointer to the ground callback currently used.
const FGMatrix33 & GetTec2i(void) const
Transform matrix from the earth centered to inertial frame.
const FGLocation & operator-=(const FGLocation &l)
This operator substracts the ECEF position vectors.
const FGMatrix33 & GetTl2ec(void) const
Transform matrix from local horizontal to earth centered frame.
const FGMatrix33 & GetTi2l(void) const
Transform matrix from the inertial to local horizontal frame.
double & operator()(unsigned int idx)
Write access the entries of the vector.
void IncrementEarthPositionAngle(double delta)
Increments the Earth position angle.
bool operator!=(const FGLocation &l) const
This operator returns true if the ECEF location vectors for the two location objects are not equal...
double GetAltitudeAGL(void) const
Get the altitude above ground level.