📄 position.hpp
字号:
// if you can see this, ignore the \'s below, as they are for // the nasty html-ifying of doxygen. Browsers try to // interpret the % and they get all messed up. /** * Format this Position into a string. * * Generate and return a string containing formatted * Position coordinates, formatted by the specification \c fmt. * * \li \%x X() (meters) * \li \%y Y() (meters) * \li \%z Z() (meters) * \li \%X X()/1000 (kilometers) * \li \%Y Y()/1000 (kilometers) * \li \%Z Z()/1000 (kilometers) * \li \%A geodeticLatitude() (degrees North) * \li \%a geocentricLatitude() (degrees North) * \li \%L longitude() (degrees East) * \li \%l longitude() (degrees East) * \li \%w longitude() (degrees West) * \li \%W longitude() (degrees West) * \li \%t theta() (degrees) * \li \%T theta() (radians) * \li \%p phi() (degrees) * \li \%P phi() (radians) * \li \%r radius() meters * \li \%R radius()/1000 kilometers * \li \%h height() meters * \li \%H height()/1000 kilometers * * @param fmt format to use for this time. * @return a string containing this Position in the * representation specified by \c fmt. */ std::string printf(const char *fmt) const throw(StringUtils::StringException); /// Format this time into a string. /// @see printf(const char*) std::string printf(const std::string& fmt) const throw(StringUtils::StringException) { return printf(fmt.c_str()); } /// Returns the string that operator<<() would print. std::string asString() const throw(StringUtils::StringException); // ----------- Part 10: functions: fundamental conversions --------------- // /** Fundamental conversion from spherical to cartesian coordinates. * @param trp (input): theta, phi (degrees), radius * @param xyz (output): X,Y,Z in units of radius * Algorithm references: standard geometry. */ static void convertSphericalToCartesian(const Triple& tpr, Triple& xyz) throw(); /** Fundamental routine to convert cartesian to spherical coordinates. * The zero vector is converted to (90,0,0). * @param xyz (input): X,Y,Z * @param trp (output): theta, phi (degrees), radius (units of input) * Algorithm references: standard geometry. */ static void convertCartesianToSpherical(const Triple& xyz, Triple& tpr) throw(); /** Fundamental routine to convert ECEF (cartesian) to geodetic coordinates, * (Geoid specified by semi-major axis and eccentricity squared). * The zero vector is converted to (90,0,-R(earth)). * @param xyz (input): X,Y,Z in meters * @param llh (output): geodetic lat(deg N), lon(deg E), * height above ellipsoid (meters) * @param A (input) Earth semi-major axis * @param eccSq (input) square of Earth eccentricity * Algorithm references: Leick, "GPS Satellite Surveying," 2nd edition. */ static void convertCartesianToGeodetic(const Triple& xyz, Triple& llh, const double A, const double eccSq) throw(); /** Fundamental routine to convert geodetic to ECEF (cartesian) coordinates, * (Geoid specified by semi-major axis and eccentricity squared). * @param llh (input): geodetic lat(deg N), lon(deg E), * height above ellipsoid (meters) * @param A (input) Earth semi-major axis * @param xyz (output): X,Y,Z in meters * @param eccSq (input) square of Earth eccentricity * Algorithm references: Leick, "GPS Satellite Surveying," 2nd edition. */ static void convertGeodeticToCartesian(const Triple& llh, Triple& xyz, const double A, const double eccSq) throw(); /** Fundamental routine to convert cartesian (ECEF) to geocentric * The zero vector is converted to (0,0,0). * @param xyz (input): X,Y,Z * @param llr (output): geocentric lat(deg N), lon(deg E), * radius (units of input) */ static void convertCartesianToGeocentric(const Triple& xyz, Triple& llr) throw(); /** Fundamental routine to convert geocentric to cartesian (ECEF) * @param llr (input): geocentric lat(deg N),lon(deg E),radius * @param xyz (output): X,Y,Z (units of radius) */ static void convertGeocentricToCartesian(const Triple& llr, Triple& xyz) throw(); /** Fundamental routine to convert geocentric to geodetic * @param llr (input): geocentric lat(deg N),lon(deg E),radius (meters) * @param geodeticllh (output): geodetic latitude (deg N), * longitude (deg E), and height above ellipsoid (meters) * @param A (input) Earth semi-major axis * @param eccSq (input) square of Earth eccentricity */ static void convertGeocentricToGeodetic(const Triple& llr, Triple& geodeticllh, const double A, const double eccSq) throw(); /** Fundamental routine to convert geodetic to geocentric * @param geodeticllh (input): geodetic latitude (deg N), * longitude (deg E), and height above ellipsoid (meters) * @param llr (output): geocentric lat (deg N),lon (deg E),radius (meters) * @param A (input) Earth semi-major axis * @param eccSq (input) square of Earth eccentricity */ static void convertGeodeticToGeocentric(const Triple& geodeticllh, Triple& llr, const double A, const double eccSq) throw(); // ----------- Part 11: operator<< and other useful functions ------------- // /** * Stream output for Position objects. * @param s stream to append formatted Position to. * @param t Position to append to stream \c s. * @return reference to \c s. */ friend std::ostream& operator<<(std::ostream& s, const Position& p); /** * Compute the range in meters between two Positions. * Input Positions are not modified. * @param A,B Positions between which to find the range * @return the range (in meters) * @throw GeometryException if geoid values differ. * or if transformTo(Cartesian) fails */ friend double range(const Position& A, const Position& B) throw(GeometryException); /** * Compute the radius of the ellipsoidal Earth, given the geodetic latitude. * @param geolat geodetic latitude in degrees * @return the Earth radius (in meters) */ static double radiusEarth(const double geolat, const double A, const double eccSq) throw(); /** * A member function that calls the non-member radiusEarth() for * this Position. * @return the Earth radius (in meters) */ double radiusEarth() const throw() { Position p(*this); p.transformTo(Position::Geodetic); return Position::radiusEarth(p.theArray[0], p.AEarth, p.eccSquared); } /** * A member function that computes the elevation of the input * (Target) position as seen from this Position. * @param Target the Position which is observed to have the * computed elevation, as seen from this Position. * @return the elevation in degrees */ double elevation(const Position& Target) const throw(GeometryException); /** * A member function that computes the elevation of the input * (Target) position as seen from this Position, using a Geodetic * (ellipsoidal) system. * @param Target the Position which is observed to have the * computed elevation, as seen from this Position. * @return the elevation in degrees */ double elevationGeodetic(const Position& Target) const throw(GeometryException); /** * A member function that computes the azimuth of the input * (Target) position as seen from this Position. * @param Target the Position which is observed to have the * computed azimuth, as seen from this Position. * @return the azimuth in degrees */ double azimuth(const Position& Target) const throw(GeometryException); /** * A member function that computes the azimuth of the input * (Target) position as seen from this Position, using a Geodetic * (ellipsoidal) system. * @param Target the Position which is observed to have the * computed azimuth, as seen from this Position. * @return the azimuth in degrees */ double azimuthGeodetic(const Position& Target) const throw(GeometryException); /** * 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. * @param elev elevation angle in degrees of the signal at reception * @param azim azimuth angle in degrees of the signal at reception * @param ionoht height of the ionosphere, in meters * @return Position IPP the position of the ionospheric pierce point, * in the same coordinate system as *this; *this is not modified. */ Position getIonosphericPiercePoint(const double elev, const double azim, const double ionoht) const throw(); // ----------- Part 12: private functions and member data ----------------- // private: /** Initialization function, used by the constructors. * @param a coordinate [ X(m), or latitude (degrees N) ] * @param b coordinate [ Y(m), or longitude (degrees E) ] * @param c coordinate [ Z, height above ellipsoid or radius, in m ] * @param s CoordinateSystem, defaults to Cartesian * @param geiod pointer to a GeoidModel, default NULL (WGS84) * @throw GeometryException on invalid input. */ void initialize(const double a, const double b, const double c, CoordinateSystem s = Cartesian, GeoidModel *geoid = NULL) throw(GeometryException); /* Values of the coordinates, defined for each system as follows; * Cartesian : X,Y,Z in meters * Geocentric : Latitude(degrees N), Longitude(degrees E), * Radius (meters) * Geodetic : Latitude(degrees N), Longitude(degrees E), * Height above ellipsoid (meters) * Spherical : theta (degrees) - angle from the z axis * phi (degrees) - angle in xy plane from x axis toward * y axis (same as longitude) * radius (meters?) - distance from origin */ // use std::valarray<double> theArray; -- inherit from Triple /// semi-major axis of Earth (meters) double AEarth; /// square of geoid eccentricity double eccSquared; /// see #CoordinateSystem CoordinateSystem system; /// tolerance used in comparisons double tolerance; }; // end class Position //@}} // namespace gpstk#endif // GPSTK_POSITION_HPP
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -