add doxygen via opencode
This commit is contained in:
@@ -29,21 +29,53 @@
|
||||
|
||||
#include "pimathbase.h"
|
||||
|
||||
//! \~english Geographical ellipsoid Earth model
|
||||
//! \~russian Географическая эллипсоидная модель Земли
|
||||
class PIP_EXPORT PIEllipsoidModel {
|
||||
public:
|
||||
//! \~english Default constructor
|
||||
//! \~russian Конструктор по умолчанию
|
||||
PIEllipsoidModel();
|
||||
double eccSquared() const { return eccentricity * eccentricity; } // eccentricity squared
|
||||
|
||||
//! \~english Get eccentricity squared
|
||||
//! \~russian Получить квадрат эксцентриситета
|
||||
double eccSquared() const { return eccentricity * eccentricity; }
|
||||
|
||||
//! \~english Get semi-minor axis (b)
|
||||
//! \~russian Получить малую полуось (b)
|
||||
double b() const { return a * sqrt(1 - eccSquared()); }
|
||||
|
||||
//! \~english WGS84 ellipsoid model
|
||||
//! \~russian Эллипсоид WGS84
|
||||
static PIEllipsoidModel WGS84Ellipsoid();
|
||||
|
||||
//! \~english PZ90 ellipsoid model
|
||||
//! \~russian Эллипсоид ПЗ-90
|
||||
static PIEllipsoidModel PZ90Ellipsoid();
|
||||
|
||||
//! \~english GPS ellipsoid (same as WGS84)
|
||||
//! \~russian Эллипсоид GPS (то же что WGS84)
|
||||
static PIEllipsoidModel GPSEllipsoid();
|
||||
|
||||
//! \~english Krasovskiy ellipsoid model
|
||||
//! \~russian Эллипсоид Красовского
|
||||
static PIEllipsoidModel KrasovskiyEllipsoid();
|
||||
|
||||
double a; /// Major axis of Earth in meters
|
||||
double flattening; /// Flattening (ellipsoid parameter)
|
||||
double eccentricity; /// Eccentricity (ellipsoid parameter)
|
||||
double angVelocity; /// Angular velocity of Earth in radians/sec
|
||||
//! \~english Major semi-axis (meters)
|
||||
//! \~russian Большая полуось (метры)
|
||||
double a;
|
||||
|
||||
//! \~english Flattening (f = (a-b)/a)
|
||||
//! \~russian Сплюснутость (f = (a-b)/a)
|
||||
double flattening;
|
||||
|
||||
//! \~english First eccentricity
|
||||
//! \~russian Первый эксцентриситет
|
||||
double eccentricity;
|
||||
|
||||
//! \~english Angular velocity (rad/sec)
|
||||
//! \~russian Угловая скорость (рад/сек)
|
||||
double angVelocity;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -29,147 +29,338 @@
|
||||
#include "piellipsoidmodel.h"
|
||||
#include "pimathvector.h"
|
||||
|
||||
//! \~english Geographical position class
|
||||
//! \~russian Класс географической позиции
|
||||
class PIP_EXPORT PIGeoPosition: public PIMathVectorT3d {
|
||||
public:
|
||||
//! \~english Coordinate system types
|
||||
//! \~russian Типы систем координат
|
||||
enum CoordinateSystem {
|
||||
Unknown = 0, /// Unknown coordinate system
|
||||
Geodetic, /// Geodetic latitude, longitude, and height above ellipsoid
|
||||
Geocentric, /// Geocentric (regular spherical coordinates)
|
||||
Cartesian, /// Cartesian (Earth-centered, Earth-fixed)
|
||||
Spherical /// Spherical coordinates (theta,phi,radius)
|
||||
Unknown = 0, //!< Unknown coordinate system
|
||||
Geodetic, //!< Geodetic latitude, longitude, and height above ellipsoid
|
||||
Geocentric, //!< Geocentric (regular spherical coordinates)
|
||||
Cartesian, //!< Cartesian (Earth-centered, Earth-fixed)
|
||||
Spherical //!< Spherical coordinates (theta,phi,radius)
|
||||
};
|
||||
|
||||
static const double one_cm_tolerance; /// One centimeter tolerance.
|
||||
static const double one_mm_tolerance; /// One millimeter tolerance.
|
||||
static const double one_um_tolerance; /// One micron tolerance.
|
||||
static double position_tolerance; /// Default tolerance (default 1mm)
|
||||
//! \~english One centimeter tolerance
|
||||
//! \~russian Допуск один сантиметр
|
||||
static const double one_cm_tolerance;
|
||||
|
||||
//! \~english One millimeter tolerance
|
||||
//! \~russian Допуск один миллиметр
|
||||
static const double one_mm_tolerance;
|
||||
|
||||
//! \~english One micron tolerance
|
||||
//! \~russian Допуск один микрон
|
||||
static const double one_um_tolerance;
|
||||
|
||||
//! \~english Default position tolerance (default 1mm)
|
||||
//! \~russian Допуск позиции по умолчанию (по умолчанию 1мм)
|
||||
static double position_tolerance;
|
||||
|
||||
//! \~english Set position tolerance
|
||||
//! \~russian Установить допуск позиции
|
||||
//! \param tol New tolerance value
|
||||
//! \return Previous tolerance value
|
||||
static double setPositionTolerance(const double tol) {
|
||||
position_tolerance = tol;
|
||||
return position_tolerance;
|
||||
}
|
||||
|
||||
//! \~english Get position tolerance
|
||||
//! \~russian Получить допуск позиции
|
||||
static double getPositionTolerance() { return position_tolerance; }
|
||||
|
||||
//! \~english Default constructor
|
||||
//! \~russian Конструктор по умолчанию
|
||||
PIGeoPosition();
|
||||
|
||||
//! \~english Constructor with coordinates
|
||||
//! \~russian Конструктор с координатами
|
||||
//! \param a First coordinate
|
||||
//! \param b Second coordinate
|
||||
//! \param c Third coordinate
|
||||
//! \param s Coordinate system
|
||||
//! \param ell Ellipsoid model
|
||||
PIGeoPosition(double a, double b, double c, CoordinateSystem s = Cartesian, PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
//! \~english Constructor from vector
|
||||
//! \~russian Конструктор из вектора
|
||||
//! \param v Vector with coordinates
|
||||
//! \param s Coordinate system
|
||||
//! \param ell Ellipsoid model
|
||||
PIGeoPosition(PIMathVectorT3d v, CoordinateSystem s = Cartesian, PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
|
||||
//! \~english Transform to specified coordinate system
|
||||
//! \~russian Преобразовать в указанную систему координат
|
||||
//! \param sys Target coordinate system
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & transformTo(CoordinateSystem sys);
|
||||
|
||||
//! \~english Convert to geodetic coordinates
|
||||
//! \~russian Преобразовать в геодезические координаты
|
||||
PIGeoPosition & asGeodetic() {
|
||||
transformTo(Geodetic);
|
||||
return *this;
|
||||
} /// Convert to geodetic coordinate
|
||||
}
|
||||
|
||||
//! \~english Convert to geodetic coordinates using specified ellipsoid
|
||||
//! \~russian Преобразовать в геодезические координаты с указанным эллипсоидом
|
||||
//! \param ell Ellipsoid model to use
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & asGeodetic(const PIEllipsoidModel & ell) {
|
||||
setEllipsoidModel(ell);
|
||||
transformTo(Geodetic);
|
||||
return *this;
|
||||
} /// Convert to another ell, then to geodetic coordinates
|
||||
}
|
||||
|
||||
//! \~english Convert to ECEF (cartesian) coordinates
|
||||
//! \~russian Преобразовать в координаты ECEF (декартовы)
|
||||
PIGeoPosition & asECEF() {
|
||||
transformTo(Cartesian);
|
||||
return *this;
|
||||
} /// Convert to cartesian coordinates
|
||||
}
|
||||
|
||||
//! \~english Get X coordinate (or first coordinate in Cartesian)
|
||||
//! \~russian Получить координату X (или первую координату в Декартовой)
|
||||
double x() const;
|
||||
|
||||
//! \~english Get Y coordinate (or second coordinate in Cartesian)
|
||||
//! \~russian Получить координату Y (или вторую координату в Декартовой)
|
||||
double y() const;
|
||||
|
||||
//! \~english Get Z coordinate (or third coordinate in Cartesian)
|
||||
//! \~russian Получить координату Z (или третью координату в Декартовой)
|
||||
double z() const;
|
||||
|
||||
//! \~english Get geodetic latitude in degrees
|
||||
//! \~russian Получить геодезическую широту в градусах
|
||||
double latitudeGeodetic() const;
|
||||
|
||||
//! \~english Get geocentric latitude in degrees
|
||||
//! \~russian Получить геоцентрическую широту в градусах
|
||||
double latitudeGeocentric() const;
|
||||
|
||||
//! \~english Get longitude in degrees
|
||||
//! \~russian Получить долготу в градусах
|
||||
double longitude() const;
|
||||
|
||||
//! \~english Get theta (angle from Z axis) in degrees
|
||||
//! \~russian Получить тета (угол от оси Z) в градусах
|
||||
double theta() const;
|
||||
|
||||
//! \~english Get phi (angle in XY plane from X axis) in degrees
|
||||
//! \~russian Получить фи (угол в плоскости XY от оси X) в градусах
|
||||
double phi() const;
|
||||
|
||||
//! \~english Get radius (distance from Earth center)
|
||||
//! \~russian Получить радиус (расстояние от центра Земли)
|
||||
double radius() const;
|
||||
|
||||
//! \~english Get height above ellipsoid
|
||||
//! \~russian Получить высоту над эллипсоидом
|
||||
double height() const;
|
||||
|
||||
/// Set the ellipsoid values for this PIGeoPosition given a ellipsoid.
|
||||
//! \~english Set ellipsoid model for this position
|
||||
//! \~russian Установить модель эллипсоида для этой позиции
|
||||
//! \param ell Ellipsoid model
|
||||
void setEllipsoidModel(const PIEllipsoidModel & ell) { el = ell; }
|
||||
|
||||
/// Set the \a PIGeoPosition given geodetic coordinates in degrees. \a CoordinateSystem is set to \a Geodetic.
|
||||
//! \~english Set position from geodetic coordinates
|
||||
//! \~russian Установить позицию из геодезических координат
|
||||
//! \param lat Latitude in degrees
|
||||
//! \param lon Longitude in degrees
|
||||
//! \param ht Height above ellipsoid
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & setGeodetic(double lat, double lon, double ht, PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
/// Set the \a PIGeoPosition given geocentric coordinates in degrees. \a CoordinateSystem is set to \a Geocentric
|
||||
//! \~english Set position from geocentric coordinates
|
||||
//! \~russian Установить позицию из геоцентрических координат
|
||||
//! \param lat Latitude in degrees
|
||||
//! \param lon Longitude in degrees
|
||||
//! \param rad Radius
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & setGeocentric(double lat, double lon, double rad);
|
||||
|
||||
/// Set the \a PIGeoPosition given spherical coordinates in degrees. \a CoordinateSystem is set to \a Spherical
|
||||
//! \~english Set position from spherical coordinates
|
||||
//! \~russian Установить позицию из сферических координат
|
||||
//! \param theta Angle from Z axis in degrees
|
||||
//! \param phi Angle in XY plane from X axis in degrees
|
||||
//! \param rad Radius
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & setSpherical(double theta, double phi, double rad);
|
||||
|
||||
/// Set the \a PIGeoPosition given ECEF coordinates in meeters. \a CoordinateSystem is set to \a Cartesian.
|
||||
//! \~english Set position from ECEF coordinates
|
||||
//! \~russian Установить позицию из координат ECEF
|
||||
//! \param x X coordinate in meters
|
||||
//! \param y Y coordinate in meters
|
||||
//! \param z Z coordinate in meters
|
||||
//! \return Reference to this position
|
||||
PIGeoPosition & setECEF(double x, double y, double z);
|
||||
|
||||
/// Fundamental conversion from spherical to cartesian coordinates.
|
||||
//! \~english Convert spherical to Cartesian coordinates
|
||||
//! \~russian Преобразовать сферические в декартовы координаты
|
||||
//! \param tpr Input spherical (theta, phi, radius)
|
||||
//! \param xyz Output Cartesian (x, y, z)
|
||||
static void convertSphericalToCartesian(const PIMathVectorT3d & tpr, PIMathVectorT3d & xyz);
|
||||
|
||||
/// Fundamental routine to convert cartesian to spherical coordinates.
|
||||
//! \~english Convert Cartesian to spherical coordinates
|
||||
//! \~russian Преобразовать декартовы в сферические координаты
|
||||
//! \param xyz Input Cartesian (x, y, z)
|
||||
//! \param tpr Output spherical (theta, phi, radius)
|
||||
static void convertCartesianToSpherical(const PIMathVectorT3d & xyz, PIMathVectorT3d & tpr);
|
||||
|
||||
/// Fundamental routine to convert ECEF (cartesian) to geodetic coordinates,
|
||||
//! \~english Convert Cartesian (ECEF) to geodetic coordinates
|
||||
//! \~russian Преобразовать декартовы (ECEF) в геодезические координаты
|
||||
//! \param xyz Input Cartesian (x, y, z)
|
||||
//! \param llh Output geodetic (latitude, longitude, height)
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
static void convertCartesianToGeodetic(const PIMathVectorT3d & xyz,
|
||||
PIMathVectorT3d & llh,
|
||||
PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
/// Fundamental routine to convert geodetic to ECEF (cartesian) coordinates,
|
||||
//! \~english Convert geodetic to Cartesian (ECEF) coordinates
|
||||
//! \~russian Преобразовать геодезические в декартовы (ECEF) координаты
|
||||
//! \param llh Input geodetic (latitude, longitude, height)
|
||||
//! \param xyz Output Cartesian (x, y, z)
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
static void convertGeodeticToCartesian(const PIMathVectorT3d & llh,
|
||||
PIMathVectorT3d & xyz,
|
||||
PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
/// Fundamental routine to convert cartesian (ECEF) to geocentric
|
||||
//! \~english Convert Cartesian (ECEF) to geocentric coordinates
|
||||
//! \~russian Преобразовать декартовы (ECEF) в геоцентрические координаты
|
||||
//! \param xyz Input Cartesian (x, y, z)
|
||||
//! \param llr Output geocentric (latitude, longitude, radius)
|
||||
static void convertCartesianToGeocentric(const PIMathVectorT3d & xyz, PIMathVectorT3d & llr);
|
||||
|
||||
/// Fundamental routine to convert geocentric to cartesian (ECEF)
|
||||
//! \~english Convert geocentric to Cartesian (ECEF)
|
||||
//! \~russian Преобразовать геоцентрические в декартовы (ECEF)
|
||||
//! \param llr Input geocentric (latitude, longitude, radius)
|
||||
//! \param xyz Output Cartesian (x, y, z)
|
||||
static void convertGeocentricToCartesian(const PIMathVectorT3d & llr, PIMathVectorT3d & xyz);
|
||||
|
||||
/// Fundamental routine to convert geocentric to geodetic
|
||||
//! \~english Convert geocentric to geodetic
|
||||
//! \~russian Преобразовать геоцентрические в геодезические
|
||||
//! \param llr Input geocentric (latitude, longitude, radius)
|
||||
//! \param llh Output geodetic (latitude, longitude, height)
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
static void convertGeocentricToGeodetic(const PIMathVectorT3d & llr,
|
||||
PIMathVectorT3d & llh,
|
||||
PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
/// Fundamental routine to convert geodetic to geocentric
|
||||
//! \~english Convert geodetic to geocentric
|
||||
//! \~russian Преобразовать геодезические в геоцентрические
|
||||
//! \param llh Input geodetic (latitude, longitude, height)
|
||||
//! \param llr Output geocentric (latitude, longitude, radius)
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
static void convertGeodeticToGeocentric(const PIMathVectorT3d & llh,
|
||||
PIMathVectorT3d & llr,
|
||||
PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
/// Compute the radius of the ellipsoidal Earth, given the geodetic latitude.
|
||||
//! \~english Compute radius of ellipsoid at given latitude
|
||||
//! \~russian Вычислить радиус эллипсоида на заданной широте
|
||||
//! \param geolat Geodetic latitude in degrees
|
||||
//! \param ell Ellipsoid model (default WGS84)
|
||||
//! \return Radius in meters
|
||||
static double radiusEarth(double geolat, PIEllipsoidModel ell = PIEllipsoidModel::WGS84Ellipsoid());
|
||||
|
||||
//! \~english Compute radius of ellipsoid at current position
|
||||
//! \~russian Вычислить радиус эллипсоида в текущей позиции
|
||||
double radiusEarth() const {
|
||||
PIGeoPosition p(*this);
|
||||
p.transformTo(PIGeoPosition::Geodetic);
|
||||
return PIGeoPosition::radiusEarth((*this)[0], p.el);
|
||||
}
|
||||
|
||||
/// Compute the range in meters between two PIGeoPositions.
|
||||
//! \~english Compute range between two positions
|
||||
//! \~russian Вычислить расстояние между двумя позициями
|
||||
//! \param a First position
|
||||
//! \param b Second position
|
||||
//! \return Range in meters
|
||||
static double range(const PIGeoPosition & a, const PIGeoPosition & b);
|
||||
|
||||
//! \~english Compute range from this position to another
|
||||
//! \~russian Вычислить расстояние от этой позиции до другой
|
||||
//! \param p Target position
|
||||
//! \return Range in meters
|
||||
double range(const PIGeoPosition & p) const { return range((*this), p); }
|
||||
|
||||
/// Computes the elevation of the input (p) position as seen from this PIGeoPosition.
|
||||
//! \~english Compute elevation angle to target position
|
||||
//! \~russian Вычислить угол возвышения до целевой позиции
|
||||
//! \param p Target position
|
||||
//! \return Elevation angle in degrees
|
||||
double elevation(const PIGeoPosition & p) const;
|
||||
|
||||
/// Computes the elevation of the input (p) position as seen from this PIGeoPosition, using a Geodetic (ellipsoidal) system.
|
||||
//! \~english Compute geodetic elevation angle to target position
|
||||
//! \~russian Вычислить геодезический угол возвышения до целевой позиции
|
||||
//! \param p Target position
|
||||
//! \return Elevation angle in degrees
|
||||
double elevationGeodetic(const PIGeoPosition & p) const;
|
||||
|
||||
/// Computes the azimuth of the input (p) position as seen from this PIGeoPosition.
|
||||
//! \~english Compute azimuth angle to target position
|
||||
//! \~russian Вычислить азимут до целевой позиции
|
||||
//! \param p Target position
|
||||
//! \return Azimuth angle in degrees
|
||||
double azimuth(const PIGeoPosition & p) const;
|
||||
|
||||
/// Computes the azimuth of the input (p) position as seen from this PIGeoPosition, using a Geodetic (ellipsoidal) system.
|
||||
//! \~english Compute geodetic azimuth angle to target position
|
||||
//! \~russian Вычислить геодезический азимут до целевой позиции
|
||||
//! \param p Target position
|
||||
//! \return Azimuth angle in degrees
|
||||
double azimuthGeodetic(const PIGeoPosition & p) const;
|
||||
|
||||
/// Computes the radius of curvature of the meridian (Rm) corresponding to this PIGeoPosition.
|
||||
//! \~english Get radius of curvature of the meridian
|
||||
//! \~russian Получить радиус кривизны меридиана
|
||||
//! \return Radius in meters
|
||||
double getCurvMeridian() const;
|
||||
|
||||
/// Computes the radius of curvature in the prime vertical (Rn) corresponding to this PIGeoPosition.
|
||||
//! \~english Get radius of curvature in the prime vertical
|
||||
//! \~russian Получить радиус кривизны в вертикале
|
||||
//! \return Radius in meters
|
||||
double getCurvPrimeVertical() const;
|
||||
|
||||
/// Returns as PIMathVectorT3d
|
||||
//! \~english Get as PIMathVectorT3d
|
||||
//! \~russian Получить как PIMathVectorT3d
|
||||
//! \return Reference to underlying vector
|
||||
const PIMathVectorT3d & vector() const { return *this; }
|
||||
|
||||
//! \~english Assignment from vector
|
||||
//! \~russian Присваивание из вектора
|
||||
PIGeoPosition & operator=(const PIMathVectorT3d & v);
|
||||
|
||||
//! \~english Subtraction
|
||||
//! \~russian Вычитание
|
||||
PIGeoPosition & operator-=(const PIGeoPosition & right);
|
||||
|
||||
//! \~english Addition
|
||||
//! \~russian Сложение
|
||||
PIGeoPosition & operator+=(const PIGeoPosition & right);
|
||||
|
||||
//! \~english Subtraction
|
||||
//! \~russian Вычитание
|
||||
friend PIGeoPosition operator-(const PIGeoPosition & left, const PIGeoPosition & right);
|
||||
|
||||
//! \~english Addition
|
||||
//! \~russian Сложение
|
||||
friend PIGeoPosition operator+(const PIGeoPosition & left, const PIGeoPosition & right);
|
||||
|
||||
//! \~english Scalar multiplication
|
||||
//! \~russian Умножение на скаляр
|
||||
friend PIGeoPosition operator*(const double & scale, const PIGeoPosition & right);
|
||||
friend PIGeoPosition operator*(const PIGeoPosition & left, const double & scale);
|
||||
friend PIGeoPosition operator*(const int & scale, const PIGeoPosition & right);
|
||||
friend PIGeoPosition operator*(const PIGeoPosition & left, const int & scale);
|
||||
|
||||
//! \~english Equality comparison
|
||||
//! \~russian Сравнение на равенство
|
||||
bool operator==(const PIGeoPosition & right) const;
|
||||
|
||||
//! \~english Inequality comparison
|
||||
//! \~russian Сравнение на неравенство
|
||||
bool operator!=(const PIGeoPosition & right) const { return !(operator==(right)); }
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user