A position representation class for common 3D geographic position formats, including geodetic (geodetic latitude, longitude, and height above the ellipsoid) geocentric (geocentric latitude, longitude, and radius from Earth's center), cartesian (Earth-centered, Earth-fixed) and spherical (theta,phi,radius).
Internally, the representation of Position consists of three coordinate values (double), two doubles from a ellipsoid model (see below, storing these doubles is preferred over adding EllipsoidModel to calling arguments everywhere), a flag of type 'enum CoordinateSystem' giving the coordinate system, and a tolerance for use in comparing Positions. Class Position inherits from class Triple, which is how the coordinate values are stored (Triple actually uses std::valarray<double> of length 3). It is important to note that Triple:: routines are properly used by Positions ONLY in the Cartesian coordinate system.
Only geodetic coordinates depend on a ellipsoid, and then only on the semi-major axis of the Earth and the square of its eccentricity. Input of this ellipsoid information (usually a pointer to a EllipsoidModel) is required by functions involving constructors of, or transformation to or from, Geodetic coordinates. However since a default is supplied (WGS84), the user need never deal with geiods unless desired. In fact, if the geodetic coordinate system is avoided, the Position class can be interpreted simply as 3D vectors in any context, particularly since the class inherits from Triple, which includes many vector manipulation routines (although the Triple:: routines assume Cartesian coordinates). Even the requirement that lengths (radius, height and the cartesian coordinates) have units of meters is required only if geodetic coordinates are used (because the semi-major axis in EllipsoidModel is in meters); without using Geodetic one could apply the class using any units for length as long as setTolerance() is called appropriately.
Position relies on a series of fundamental routines to transform from one coordinate system to another, these include, for example void Position::convertGeodeticToCartesian(const Triple& llh, Triple& xyz, const double A, const double eccSq); void Position::convertSphericalToCartesian(const Triple& tpr, Triple& xyz); These functions use Triple in the calling arguments.
Position will throw exceptions (gnsstk::GeometryException) on bad input (e.g. negative radius or latitude > 90 degrees); otherwise the class attempts to handle all points, even the pole and the origin, consistently and without throwing exceptions. At or very near the poles, the transformation routines will set latitude = +/-90 degrees, which is theta = 0 or 180, and (arbitrarily) longitude = 0. At or very near the origin, the transformation routines will set latitude = 0, which is theta = 90, and (arbitrarily) longitude = 0; radius will be set to zero and geodetic height will be set to -radius(Earth) (= -6378137.0 in WGS84). The tolerance used in testing 'at or near the pole or origin' is radius < POSITION_TOLERANCE/5. Note that this implies that a Position that is very near the origin may be SET to the exact origin by the transformation routines, and that thereby information about direction (e.g. latitude and longitude) may be LOST. The user is warned to be very careful when working near either the pole or the origin.
Position includes setToString() and printf() functions similar to those in gnsstk::CommonTime; this allows flexible and powerful I/O of Position to strings and streams.
Definition at line 136 of file Position.hpp.
#include <Position.hpp>
Public Types | |
enum | CoordinateSystem { Unknown =0, Geodetic, Geocentric, Cartesian, Spherical } |
The coordinate systems supported by Position. More... | |
Public Member Functions | |
Position & | asECEF () noexcept |
Position & | asGeodetic () noexcept |
Position & | asGeodetic (EllipsoidModel *ell) |
std::string | asString () const |
double | azimuth (const Position &Target) const |
double | azimuthGeodetic (const Position &Target) const |
void | copyEllipsoidModelFrom (const Position &src) |
double | elevation (const Position &Target) const |
double | elevationGeodetic (const Position &Target) const |
double | geocentricLatitude () const noexcept |
double | geodeticLatitude () const noexcept |
return geodetic latitude (degrees North). More... | |
double | getAEarth () const |
double | getAltitude () const noexcept |
return height above ellipsoid (meters) More... | |
CoordinateSystem | getCoordinateSystem () const noexcept |
return the coordinate system for this Position More... | |
double | getCurvMeridian () const noexcept |
double | getCurvPrimeVertical () const noexcept |
double | getGeocentricLatitude () const noexcept |
return geocentric latitude (deg N) More... | |
double | getGeodeticLatitude () const noexcept |
return geodetic latitude (deg N) More... | |
double | getHeight () const noexcept |
return height above ellipsoid (meters) More... | |
Position | getIonosphericPiercePoint (const double elev, const double azim, const double ionoht) const noexcept |
double | getLongitude () const noexcept |
return longitude (deg E) (either geocentric or geodetic) More... | |
double | getPhi () const noexcept |
return spherical coordinate angle phi (deg) (same as longitude) More... | |
double | getRadius () const noexcept |
return radius More... | |
Position | getRayPerigee (const Position &target) const |
Position | getRayPosition (double dist, const Position &target) const |
const RefFrame & | getReferenceFrame () const noexcept |
return coordinate RefFrame More... | |
std::string | getSystemName () noexcept |
return string giving name of coordinate system More... | |
double | getTheta () const noexcept |
double | getX () const noexcept |
return ECEF X coordinate (meters) More... | |
double | getY () const noexcept |
return ECEF Y coordinate (meters) More... | |
double | getZ () const noexcept |
return ECEF Z coordinate (meters) More... | |
Angle | getZenithAngle (const Position &target, AngleReduced &delta) const |
double | height () const noexcept |
return height above ellipsoid (meters) (Geodetic). More... | |
double | longitude () const noexcept |
bool | operator!= (const Position &right) const noexcept |
Position & | operator+= (const Position &right) noexcept |
Position & | operator-= (const Position &right) noexcept |
bool | operator== (const Position &right) const noexcept |
double | phi () const noexcept |
return spherical coordinate phi in degrees More... | |
Position () noexcept | |
Position (const double &a, const double &b, const double &c, CoordinateSystem s=Cartesian, const EllipsoidModel *ell=nullptr, const RefFrame &frame=RefFrame()) | |
Position (const double ABC[3], CoordinateSystem s=Cartesian, const EllipsoidModel *ell=nullptr, const RefFrame &frame=RefFrame()) | |
Position (const Triple &ABC, CoordinateSystem s=Cartesian, const EllipsoidModel *ell=nullptr, const RefFrame &frame=RefFrame()) | |
Position (const Xvt &xvt) noexcept | |
std::string | printf (const char *fmt) const |
std::string | printf (const std::string &fmt) const |
double | radius () const noexcept |
double | radiusEarth () const noexcept |
Position & | setECEF (const double X, const double Y, const double Z) noexcept |
Position & | setECEF (const double XYZ[3]) noexcept |
Position & | setECEF (const Triple &XYZ) noexcept |
void | setEllipsoidModel (const EllipsoidModel *ell) |
Position & | setGeocentric (const double lat, const double lon, const double rad) |
Position & | setGeodetic (const double lat, const double lon, const double ht, const EllipsoidModel *ell=nullptr) |
void | setReferenceFrame (const RefFrame &frame) noexcept |
Position & | setSpherical (const double theta, const double phi, const double rad) |
Position & | setTolerance (const double tol) noexcept |
Position & | setToString (const std::string &str, const std::string &fmt) |
double | theta () const noexcept |
return spherical coordinate theta in degrees More... | |
Position & | transformTo (CoordinateSystem sys) noexcept |
double | X () const noexcept |
return X coordinate (meters) More... | |
double | Y () const noexcept |
return Y coordinate (meters) More... | |
double | Z () const noexcept |
return Z coordinate (meters) More... | |
~Position () noexcept | |
Destructor. More... | |
![]() | |
double | azAngle (const Triple &right) const |
double | cosVector (const Triple &right) const |
Triple | cross (const Triple &right) const noexcept |
double | dot (const Triple &right) const noexcept |
double | elvAngle (const Triple &right) const |
double | mag () const noexcept |
Triple | operator+ (const Triple &right) const |
Triple | operator- (const Triple &right) const |
Triple & | operator= (const std::valarray< double > &right) |
Triple & | operator= (const Triple &right) |
Assignment operator. More... | |
bool | operator== (const Triple &right) const |
double & | operator[] (const size_t index) |
double | operator[] (const size_t index) const |
Triple | R1 (const double &angle) const noexcept |
Triple | R2 (const double &angle) const noexcept |
Triple | R3 (const double &angle) const noexcept |
size_t | size (void) const |
Return the size of this object. More... | |
double | slantRange (const Triple &right) const noexcept |
std::vector< double > | toStdVector () |
Return the data as a std::vector object. More... | |
Vector< double > | toVector () |
Return the data as a Vector<double> object. More... | |
Triple () | |
Default constructor, initialize as triple. More... | |
Triple (const Triple &right) | |
Copy constructor. More... | |
Triple (double a, double b, double c) | |
Construct from three doubles. More... | |
Triple | unitVector () const |
virtual | ~Triple () |
Destructor. More... | |
Static Public Member Functions | |
static void | convertCartesianToGeocentric (const Triple &xyz, Triple &llr) noexcept |
static void | convertCartesianToGeodetic (const Triple &xyz, Triple &llh, const double A, const double eccSq) noexcept |
static void | convertCartesianToSpherical (const Triple &xyz, Triple &tpr) noexcept |
static void | convertGeocentricToCartesian (const Triple &llr, Triple &xyz) noexcept |
static void | convertGeocentricToGeodetic (const Triple &llr, Triple &geodeticllh, const double A, const double eccSq) noexcept |
static void | convertGeodeticToCartesian (const Triple &llh, Triple &xyz, const double A, const double eccSq) noexcept |
static void | convertGeodeticToGeocentric (const Triple &geodeticllh, Triple &llr, const double A, const double eccSq) noexcept |
static void | convertSphericalToCartesian (const Triple &tpr, Triple &xyz) noexcept |
static double | getPositionTolerance () |
Returns the current POSITION_TOLERANCE. More... | |
static Angle | getZenithAngle (const Angle &phi1, const Angle &lambda1, const Angle &phi2, const Angle &lambda2, double r1, double r2, AngleReduced &delta) |
static double | radiusEarth (const double geolat, const double A, const double eccSq) noexcept |
static double | setPositionTolerance (const double tol) |
Changes the POSITION_TOLERANCE for all Position objects. More... | |
Static Public Attributes | |
static const GNSSTK_EXPORT double | ONE_CM_TOLERANCE = 0.01 |
One centimeter tolerance. More... | |
static const GNSSTK_EXPORT double | ONE_MM_TOLERANCE = 0.001 |
One millimeter tolerance. More... | |
static const GNSSTK_EXPORT double | ONE_UM_TOLERANCE = 0.000001 |
One micron tolerance. More... | |
static GNSSTK_EXPORT double | POSITION_TOLERANCE = Position::ONE_MM_TOLERANCE |
Default tolerance for time equality in days. More... | |
Private Member Functions | |
void | initialize (const double a, const double b, const double c, CoordinateSystem s=Cartesian, const EllipsoidModel *ell=nullptr, const RefFrame &frame=RefFrame()) |
Private Attributes | |
double | AEarth |
semi-major axis of Earth (meters) More... | |
double | eccSquared |
square of ellipsoid eccentricity More... | |
RefFrame | refFrame |
CoordinateSystem | system |
see CoordinateSystem More... | |
double | tolerance |
tolerance used in comparisons More... | |
Friends | |
Position | operator* (const double &scale, const Position &right) |
Position | operator* (const int &scale, const Position &right) |
Position | operator* (const Position &left, const double &scale) |
Position | operator* (const Position &left, const int &scale) |
Position | operator+ (const Position &left, const Position &right) noexcept |
Position | operator- (const Position &left, const Position &right) noexcept |
std::ostream & | operator<< (std::ostream &s, const Position &p) |
double | range (const Position &A, const Position &B) |
Additional Inherited Members | |
![]() | |
std::valarray< double > | theArray |
The coordinate systems supported by Position.
Definition at line 142 of file Position.hpp.
|
noexcept |
Default constructor. Initializes to zero, Unknown coordinates
Definition at line 92 of file Position.cpp.
gnsstk::Position::Position | ( | const double & | a, |
const double & | b, | ||
const double & | c, | ||
Position::CoordinateSystem | s = Cartesian , |
||
const EllipsoidModel * | ell = nullptr , |
||
const RefFrame & | frame = RefFrame() |
||
) |
Explicit constructor. Coordinate system may be specified on input, but defaults to Cartesian. Pointer to EllipsoidModel may be specified, but default is NULL (in which case WGS84 values will be used).
a | first coordinate [ X(m), or latitude (degrees N) ] |
b | second coordinate [ Y(m), or longitude (degrees E) ] |
c | third coordinate [ Z, height above ellipsoid or radius, in m ] |
s | coordinate system |
ell | pointer to EllipsoidModel |
GeometryException | on invalid input. |
Definition at line 99 of file Position.cpp.
gnsstk::Position::Position | ( | const double | ABC[3], |
CoordinateSystem | s = Cartesian , |
||
const EllipsoidModel * | ell = nullptr , |
||
const RefFrame & | frame = RefFrame() |
||
) |
Explicit constructor. Coordinate system may be specified on input, but defaults to Cartesian. Pointer to EllipsoidModel may be specified, but default is NULL (in which case WGS84 values will be used).
ABC | double array[3] coordinate values |
s | CoordinateSystem |
ell | pointer to EllipsoidModel |
GeometryException | on invalid input. |
Definition at line 114 of file Position.cpp.
gnsstk::Position::Position | ( | const Triple & | ABC, |
CoordinateSystem | s = Cartesian , |
||
const EllipsoidModel * | ell = nullptr , |
||
const RefFrame & | frame = RefFrame() |
||
) |
Explicit constructor. Coordinate system may be specified on input, but defaults to Cartesian. Pointer to EllipsoidModel may be specified, but default is NULL (in which case WGS84 values will be used).
ABC | coordinate values |
s | CoordinateSystem |
ell | pointer to EllipsoidModel |
GeometryException | on invalid input. |
Definition at line 130 of file Position.cpp.
Explicit constructor from Xvt. The coordinate system is Cartesian, and the velocity and time information in the input is ignored.
xvt | Input Xvt object, xvt.x contains the Cartesian coordinates |
Definition at line 145 of file Position.cpp.
|
inlinenoexcept |
Destructor.
Definition at line 253 of file Position.hpp.
|
inlinenoexcept |
Convert to cartesian coordinates (does nothing if system == Cartesian already).
Definition at line 390 of file Position.hpp.
|
inlinenoexcept |
Convert to geodetic coordinates (does nothing if system == Geodetic already).
Definition at line 373 of file Position.hpp.
|
inline |
Convert to another ell, then to geodetic coordinates.
GeometryException | if input is NULL. |
Definition at line 380 of file Position.hpp.
string gnsstk::Position::asString | ( | ) | const |
Returns the string that operator<<() would print.
StringUtils::StringException |
Definition at line 1031 of file Position.cpp.
A member function that computes the azimuth of the input (Target) position as seen from this Position.
Target | the Position which is observed to have the computed azimuth, as seen from this Position. |
GeometryException |
Definition at line 1365 of file Position.cpp.
A member function that computes the azimuth of the input (Target) position as seen from this Position, using a Geodetic (ellipsoidal) system.
Target | the Position which is observed to have the computed azimuth, as seen from this Position. |
GeometryException |
Definition at line 1391 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert cartesian (ECEF) to geocentric The zero vector is converted to (0,0,0).
[in] | xyz | X,Y,Z |
[out] | llr | geocentric lat(deg N), lon(deg E), radius (units of input) |
Definition at line 1144 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert ECEF (cartesian) to geodetic coordinates, (Ellipsoid specified by semi-major axis and eccentricity squared). The zero vector is converted to (90,0,-R(earth)).
[in] | xyz | X,Y,Z in meters |
[out] | llh | geodetic lat(deg N), lon(deg E), height above ellipsoid (meters) |
[in] | A | Earth semi-major axis |
[in] | eccSq | square of Earth eccentricity Algorithm references: Leick, "GPS Satellite Surveying," 2nd edition. |
Definition at line 1087 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert cartesian to spherical coordinates. The zero vector is converted to (90,0,0).
[in] | xyz | X,Y,Z |
[out] | tpr | theta, phi (degrees), radius (units of input) Algorithm references: standard geometry. |
Definition at line 1058 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert geocentric to cartesian (ECEF)
[in] | llr | geocentric lat(deg N),lon(deg E),radius |
[out] | xyz | X,Y,Z (units of radius) |
Definition at line 1155 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert geocentric to geodetic
[in] | llr | geocentric lat(deg N),lon(deg E),radius (meters) |
[out] | geodeticllh | geodetic latitude (deg N), longitude (deg E), and height above ellipsoid (meters) |
[in] | A | Earth semi-major axis |
[in] | eccSq | square of Earth eccentricity |
Definition at line 1170 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert geodetic to ECEF (cartesian) coordinates, (Ellipsoid specified by semi-major axis and eccentricity squared).
[in] | llh | geodetic lat(deg N), lon(deg E), height above ellipsoid (meters) |
[in] | A | Earth semi-major axis |
[out] | xyz | X,Y,Z in meters |
[in] | eccSq | square of Earth eccentricity Algorithm references: Leick, "GPS Satellite Surveying," 2nd edition. |
Definition at line 1126 of file Position.cpp.
|
staticnoexcept |
Fundamental routine to convert geodetic to geocentric
[in] | geodeticllh | geodetic latitude (deg N), longitude (deg E), and height above ellipsoid (meters) |
[out] | llr | geocentric lat (deg N),lon (deg E),radius (meters) |
[in] | A | Earth semi-major axis |
[in] | eccSq | square of Earth eccentricity |
Definition at line 1216 of file Position.cpp.
|
staticnoexcept |
Fundamental conversion from spherical to cartesian coordinates.
[in] | tpr | theta, phi (degrees), radius |
[out] | xyz | X,Y,Z in units of radius Algorithm references: standard geometry. |
Definition at line 1044 of file Position.cpp.
This is a bit of a kludge to deal with the fact that Position doesn't store the actual ellipsoid model but rather a couple of terms from it. It works by copying those terms from another object into this one.
[in] | src | The Position object from which to copy ellipsoid model parameters. |
Definition at line 1018 of file Position.hpp.
A member function that computes the elevation of the input (Target) position as seen from this Position.
Target | the Position which is observed to have the computed elevation, as seen from this Position. |
GeometryException |
Definition at line 1308 of file Position.cpp.
A member function that computes the elevation of the input (Target) position as seen from this Position, using a Geodetic (ellipsoidal) system.
Target | the Position which is observed to have the computed elevation, as seen from this Position. |
GeometryException |
Definition at line 1331 of file Position.cpp.
|
noexcept |
return geocentric latitude (degrees North); equal to 90 degress - theta in regular spherical coordinates.
Definition at line 398 of file Position.cpp.
|
noexcept |
return geodetic latitude (degrees North).
Definition at line 386 of file Position.cpp.
|
inline |
Return the Earth semi-major axis (in meters) currently used for coordinate conversion
Definition at line 1026 of file Position.hpp.
|
inlinenoexcept |
return height above ellipsoid (meters)
Definition at line 469 of file Position.hpp.
|
inlinenoexcept |
return the coordinate system for this Position
Definition at line 449 of file Position.hpp.
|
noexcept |
A member function that computes the radius of curvature of the meridian (Rm) corresponding to this Position.
Definition at line 1487 of file Position.cpp.
|
noexcept |
A member function that computes the radius of curvature in the prime vertical (Rn) corresponding to this Position.
Definition at line 1503 of file Position.cpp.
|
inlinenoexcept |
return geocentric latitude (deg N)
Definition at line 459 of file Position.hpp.
|
inlinenoexcept |
return geodetic latitude (deg N)
Definition at line 454 of file Position.hpp.
|
inlinenoexcept |
return height above ellipsoid (meters)
Definition at line 474 of file Position.hpp.
|
noexcept |
A member function that computes the position at which a signal, which is received at this Position and there is observed at the (input) azimuth and elevation angles, crosses a model ionosphere that is taken to be a thin shell at constant (input) height.
This function will not transform this Position, and it will return a Position in the same system; the algorithm itself is done in the geocentric coordinate system.
elev | elevation angle in degrees of the signal at reception |
azim | azimuth angle in degrees of the signal at reception |
ionoht | height of the ionosphere, in meters |
Definition at line 1450 of file Position.cpp.
|
inlinenoexcept |
return longitude (deg E) (either geocentric or geodetic)
Definition at line 464 of file Position.hpp.
|
inlinenoexcept |
return spherical coordinate angle phi (deg) (same as longitude)
Definition at line 500 of file Position.hpp.
|
inlinestatic |
Returns the current POSITION_TOLERANCE.
Definition at line 172 of file Position.hpp.
|
inlinenoexcept |
return radius
Definition at line 505 of file Position.hpp.
Compute the ray-perigee position for the ray between this position and another. This position (P1) is expected to be a surface observer, while the target position (P2) is expected to be that of a satellite in orbit.
[in] | target | The orbital satellite position. |
Definition at line 1552 of file Position.cpp.
Compute the coordinates at a given distance along a path between two positions.
[in] | dist | The distance in METERS along the path between this and target. |
[in] | target | The target position of the ray (e.g. ray perigee coordinates). |
< Great circle angle from ray-perigee to satellite
< azimuth of satellite as seen from ray-perigee pp
Definition at line 1604 of file Position.cpp.
return coordinate RefFrame
Definition at line 346 of file Position.cpp.
|
noexcept |
return string giving name of coordinate system
Definition at line 63 of file Position.cpp.
|
inlinenoexcept |
Definition at line 495 of file Position.hpp.
|
inlinenoexcept |
return ECEF X coordinate (meters)
Definition at line 479 of file Position.hpp.
|
inlinenoexcept |
return ECEF Y coordinate (meters)
Definition at line 484 of file Position.hpp.
|
inlinenoexcept |
return ECEF Z coordinate (meters)
Definition at line 489 of file Position.hpp.
|
static |
Compute the zenith angle ζ between P1=(phi1,lambda1,r1) and P2=(phi2,lambda2,r2). With the center of Earth C, this is the angle between CP1 and P1P2. This position (P1) is expected to be a surface observer, while the target position (P2) is expected to be that of a satellite in orbit.
[in] | phi1 | The geodetic latitude of the surface observer. |
[in] | lambda1 | The longitude of the surface observer. |
[in] | phi2 | The geodetic latitude of the target satellite. |
[in] | lambda2 | The longitude of the target satellite. |
[in] | r1 | The distance from Earth center of the surface observer (units must be consistent with r2). |
[in] | r2 | The distance from Earth center of the surface observer (units must be consistent with r1). |
[out] | delta | The computed delta angle, being the Earth angle on the great circle connecting receiver antenna P1 and the satellite P2. This is used to compute the zenith angle, but is also used to compute the ray perigee, so it is output as an extra variable here. |
Definition at line 1535 of file Position.cpp.
Angle gnsstk::Position::getZenithAngle | ( | const Position & | target, |
AngleReduced & | delta | ||
) | const |
Compute the zenith angle ζ from this position to another. With the center of the earth C, this position being P1, and the second position being P2, This is the angle between CP1 and P1P2. This position (P1) is expected to be a surface observer, while the target position (P2) is expected to be that of a satellite in orbit.
[in] | target | The orbital satellite position. |
[out] | delta | The angle between CP1 and CP2. |
Definition at line 1514 of file Position.cpp.
|
noexcept |
return height above ellipsoid (meters) (Geodetic).
Definition at line 455 of file Position.cpp.
|
private |
Initialization function, used by the constructors.
a | coordinate [ X(m), or latitude (degrees N) ] |
b | coordinate [ Y(m), or longitude (degrees E) ] |
c | coordinate [ Z, height above ellipsoid or radius, in m ] |
s | CoordinateSystem, defaults to Cartesian |
ell | pointer to a EllipsoidModel, default NULL (WGS84) |
GeometryException | on invalid input. |
Definition at line 1701 of file Position.cpp.
|
noexcept |
return longitude (degrees East); equal to phi in regular spherical coordinates.
Definition at line 432 of file Position.cpp.
|
noexcept |
return spherical coordinate phi in degrees
Definition at line 420 of file Position.cpp.
std::string gnsstk::Position::printf | ( | const char * | fmt | ) | const |
Format this Position into a string.
Generate and return a string containing formatted Position coordinates, formatted by the specification fmt
.
fmt | format to use for this time. |
fmt
. StringUtils::StringException |
Definition at line 982 of file Position.cpp.
|
inline |
Format this time into a string.
StringUtils::StringException |
Definition at line 694 of file Position.hpp.
|
noexcept |
return distance from the center of Earth (meters), Same as radius in spherical coordinates.
Definition at line 444 of file Position.cpp.
|
inlinenoexcept |
A member function that calls the non-member radiusEarth() for this Position.
Definition at line 841 of file Position.hpp.
|
staticnoexcept |
Compute the radius of the ellipsoidal Earth, given the geodetic latitude.
geolat | geodetic latitude in degrees |
Definition at line 1292 of file Position.cpp.
Set the Position given ECEF coordinates; system is set to Cartesian.
X | ECEF X coordinate in meters. |
Y | ECEF Y coordinate in meters. |
Z | ECEF Z coordinate in meters. |
Definition at line 601 of file Position.cpp.
Set the Position given an array of ECEF coordinates; system is set to Cartesian.
XYZ | array[3] ECEF X,Y,Z coordinate in meters. |
Definition at line 584 of file Position.hpp.
Set the Position given ECEF coordinates; system is set to Cartesian.
XYZ | ECEF X,Y,Z coordinates in meters. |
Definition at line 594 of file Position.hpp.
void gnsstk::Position::setEllipsoidModel | ( | const EllipsoidModel * | ell | ) |
Set the ellipsoid values for this Position given a ellipsoid.
ell | Pointer to the EllipsoidModel. |
GeometryException | if input is NULL. |
Definition at line 478 of file Position.cpp.
Set the Position given geocentric coordinates; system is set to Geocentric
lat | geocentric latitude in degrees North |
lon | geocentric longitude in degrees East |
rad | radius from the Earth's center in meters |
GeometryException | on invalid input |
Definition at line 531 of file Position.cpp.
Position & gnsstk::Position::setGeodetic | ( | const double | lat, |
const double | lon, | ||
const double | ht, | ||
const EllipsoidModel * | ell = nullptr |
||
) |
Set the Position given geodetic coordinates; system is set to Geodetic.
lat | geodetic latitude in degrees North |
lon | geodetic longitude in degrees East |
ht | height above the ellipsoid in meters |
GeometryException | on invalid input |
Definition at line 495 of file Position.cpp.
|
inlinestatic |
Changes the POSITION_TOLERANCE for all Position objects.
Definition at line 168 of file Position.hpp.
Set the RefFrame that this position is in.
frame | The RefFrame to set to. |
Definition at line 467 of file Position.cpp.
Position & gnsstk::Position::setSpherical | ( | const double | theta, |
const double | phi, | ||
const double | rad | ||
) |
Set the Position given spherical coordinates; system is set to Spherical
theta | angle from the Z-axis (degrees) |
phi | angle from the X-axis in the XY plane (degrees) |
rad | radius from the center in meters |
GeometryException | on invalid input |
Definition at line 566 of file Position.cpp.
Sets the tolerance for output and comparisons, for this object only. See the constants in this file (e.g. ONE_MM_TOLERANCE) for some easy to use tolerance values.
tol | Tolerance in meters to be used by comparison operators. |
Definition at line 82 of file Position.cpp.
setToString, similar to scanf, this function takes a string and a format describing string in order to define Position values. The parameters it can take are listed below and described above with the printf() function.
The specification must be sufficient to define a Position. The following table lists combinations that give valid Positions. Anything more or other combinations will give unknown (read as: "bad") results so don't try it. Anything less will throw an exception.
So
works but
doesn't work (incomplete specification because it doesn't specify a Position).
Whitespace is unimportant here; the function will handle it. The caller must ensure that that the extra characters in the format string (ie '.' ',') are in the same relative location as they are in the actual string; see the example above.
str | string from which to get the Position coordinates |
fmt | format to use to parse str . |
GeometryException | if fmt is an incomplete or invalid specification |
StringException | if an error occurs manipulating the str or fmt strings. |
Definition at line 658 of file Position.cpp.
|
noexcept |
return spherical coordinate theta in degrees
Definition at line 409 of file Position.cpp.
|
noexcept |
Transform coordinate system. Does nothing if sys already matches the current value of member CoordinateSystem 'system'.
sys | CoordinateSystem into which this Position is transformed |
Definition at line 247 of file Position.cpp.
|
noexcept |
return X coordinate (meters)
Definition at line 353 of file Position.cpp.
|
noexcept |
return Y coordinate (meters)
Definition at line 364 of file Position.cpp.
|
noexcept |
return Z coordinate (meters)
Definition at line 375 of file Position.cpp.
Multiply a Position by a double scalar on the left.
right | Position to be multiplied by the scalar |
scale | the (double) scalar |
Definition at line 303 of file Position.hpp.
Multiply a Position by an integer scalar on the left.
right | Position to be multiplied by the scalar |
scale | the (int) scalar |
Definition at line 327 of file Position.hpp.
Multiply a Position by a double scalar on the right.
left | Position to be multiplied by the scalar |
scale | the (double) scalar |
Definition at line 316 of file Position.hpp.
Multiply a Position by an integer scalar on the right.
left | Position to be multiplied by the scalar |
scale | the (int) scalar |
Definition at line 338 of file Position.hpp.
Add two Positions, returning result as a Position in Cartesian coordinates, the only system in which a position sum makes sense.
right | Position to add to this one. |
Definition at line 204 of file Position.cpp.
Difference two Positions, returning result as a Position in Cartesian coordinates, the only system in which a position difference makes sense.
right | Position to subtract from this one. |
Definition at line 190 of file Position.cpp.
Compute the range in meters between two Positions. Input Positions are not modified.
A,B | Positions between which to find the range |
GeometryException | if ellipsoid values differ. or if transformTo(Cartesian) fails |
GeometryException |
Definition at line 1273 of file Position.cpp.
|
private |
semi-major axis of Earth (meters)
Definition at line 1062 of file Position.hpp.
|
private |
square of ellipsoid eccentricity
Definition at line 1065 of file Position.hpp.
|
static |
One centimeter tolerance.
Definition at line 160 of file Position.hpp.
|
static |
One millimeter tolerance.
Definition at line 158 of file Position.hpp.
|
static |
One micron tolerance.
Definition at line 162 of file Position.hpp.
|
static |
Default tolerance for time equality in days.
Definition at line 165 of file Position.hpp.
|
private |
Definition at line 1073 of file Position.hpp.
|
private |
see CoordinateSystem
Definition at line 1068 of file Position.hpp.
|
private |
tolerance used in comparisons
Definition at line 1071 of file Position.hpp.