![]() |
PIP 5.6.1
Platform-Independent Primitives
|
Geographic position represented in one of several coordinate systems. This class provides functionality for storing and converting between different coordinate systems including geodetic, geocentric, Cartesian, and spherical coordinates. It supports various ellipsoid models for Earth representation. More...
#include <pigeoposition.h>

Public Types | |
| enum | CoordinateSystem { } |
| Coordinate system used by stored components. More... | |
Public Member Functions | |
| PIGeoPosition () | |
| Constructs the zero position in Cartesian coordinates. | |
| PIGeoPosition (double a, double b, double c, CoordinateSystem s=Cartesian, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) | |
| Constructs a position from three components in the selected coordinate system. | |
| PIGeoPosition (PIMathVectorT3d v, CoordinateSystem s=Cartesian, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) | |
| Constructs a position from an existing 3D vector. | |
| PIGeoPosition & | transformTo (CoordinateSystem sys) |
| Converts the stored value to another coordinate system in place. | |
| PIGeoPosition & | asGeodetic () |
| Converts this position to geodetic coordinates. | |
| PIGeoPosition & | asGeodetic (const PIEllipsoidModel &ell) |
| Switches to another ellipsoid and converts to geodetic coordinates. | |
| PIGeoPosition & | asECEF () |
| Converts this position to Cartesian ECEF coordinates. | |
| double | x () const |
| Returns the X component in Cartesian ECEF coordinates. | |
| double | y () const |
| Returns the Y component in Cartesian ECEF coordinates. | |
| double | z () const |
| Returns the Z component in Cartesian ECEF coordinates. | |
| double | latitudeGeodetic () const |
| Returns geodetic latitude in degrees. | |
| double | latitudeGeocentric () const |
| Returns geocentric latitude in degrees. | |
| double | longitude () const |
| Returns longitude in degrees. | |
| double | theta () const |
| Returns spherical theta angle in degrees (angle from Z axis). | |
| double | phi () const |
| Returns spherical phi angle in degrees (angle in XY plane from X axis). | |
| double | radius () const |
| Returns radius in meters for spherical or geocentric form (distance from Earth center). | |
| double | height () const |
| Returns geodetic height above the ellipsoid in meters. | |
| void | setEllipsoidModel (const PIEllipsoidModel &ell) |
| Sets the ellipsoid model used by geodetic conversions. | |
| PIGeoPosition & | setGeodetic (double lat, double lon, double ht, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Sets geodetic latitude, longitude and height in degrees/meters. | |
| PIGeoPosition & | setGeocentric (double lat, double lon, double rad) |
| Sets geocentric latitude, longitude and radius in degrees/meters. | |
| PIGeoPosition & | setSpherical (double theta, double phi, double rad) |
| Sets spherical theta, phi and radius in degrees/meters. | |
| PIGeoPosition & | setECEF (double x, double y, double z) |
| Sets Cartesian ECEF coordinates in meters. | |
| double | radiusEarth () const |
| Returns ellipsoid radius for this position. | |
| double | range (const PIGeoPosition &p) const |
| Returns straight-line range to another position in meters. | |
| double | elevation (const PIGeoPosition &p) const |
| Computes elevation to another position. | |
| double | elevationGeodetic (const PIGeoPosition &p) const |
| Computes elevation using local geodetic vertical. | |
| double | azimuth (const PIGeoPosition &p) const |
| Computes azimuth to another position. | |
| double | azimuthGeodetic (const PIGeoPosition &p) const |
| Computes azimuth using local geodetic north-east axes. | |
| double | getCurvMeridian () const |
| Returns meridian radius of curvature for this position. | |
| double | getCurvPrimeVertical () const |
| Returns prime-vertical radius of curvature for this position. | |
| const PIMathVectorT3d & | vector () const |
| Returns the underlying three-component vector in the current system. | |
| PIGeoPosition & | operator= (const PIMathVectorT3d &v) |
| Assigns coordinates from a plain 3D vector without changing metadata. | |
| PIGeoPosition & | operator-= (const PIGeoPosition &right) |
| Subtracts another position after converting both operands to Cartesian coordinates. | |
| PIGeoPosition & | operator+= (const PIGeoPosition &right) |
| Adds another position after converting both operands to Cartesian coordinates. | |
| bool | operator== (const PIGeoPosition &right) const |
| Compares two positions using the configured tolerance and ellipsoid model. | |
| bool | operator!= (const PIGeoPosition &right) const |
| Returns true when positions are not equal. | |
Public Member Functions inherited from PIMathVectorT< Size, Type > | |
| PIMathVectorT (const Type &v=Type()) | |
| Constructs a vector and fills every coordinate with v. | |
| PIMathVectorT (const PIVector< Type > &val) | |
| Constructs a fixed-size vector from a dynamic one of the same size. | |
| PIMathVectorT (std::initializer_list< Type > init_list) | |
| Constructs a vector from an initializer list with exactly Size elements. | |
| constexpr uint | size () const |
| Returns the compile-time vector dimension. | |
| _CVector & | fill (const Type &v) |
| Fills all coordinates with v. | |
| _CVector & | move (const Type &v) |
| Adds v to every coordinate. | |
| _CVector & | move (const _CVector &v) |
| Adds another vector component-wise. | |
| _CVector & | swapElements (uint f, uint s) |
| Swaps two coordinates in place. | |
| Type | lengthSqr () const |
| Returns the squared Euclidean length. | |
| Type | length () const |
| Returns the Euclidean length. Available for arithmetic element types. | |
| Type | manhattanLength () const |
| Returns the Manhattan length. Available for arithmetic element types. | |
| Type | angleCos (const _CVector &v) const |
| Returns the cosine of the angle to v. | |
| Type | angleSin (const _CVector &v) const |
| Returns the sine of the angle to v. | |
| Type | angleRad (const _CVector &v) const |
| Returns the angle to v in radians. | |
| Type | angleDeg (const _CVector &v) const |
| Returns the angle to v in degrees. | |
| Type | angleElevation (const _CVector &v) const |
| Returns the elevation angle from this point to v in degrees. | |
| _CVector | projection (const _CVector &v) |
| Returns the projection of this vector onto v. | |
| _CVector & | normalize () |
| Normalizes this vector in place. | |
| _CVector | normalized () |
| Returns a normalized copy of this vector. | |
| bool | isNull () const |
| Returns true when all coordinates are zero. | |
| bool | isOrtho (const _CVector &v) const |
| Returns true when this vector is orthogonal to v. | |
| Type & | operator[] (uint index) |
| Returns writable access to a coordinate. | |
| const Type & | operator[] (uint index) const |
| Returns read-only access to a coordinate. | |
| Type | at (uint index) const |
| Returns a coordinate by value. | |
| Type & | element (uint index) |
| Returns writable access to a coordinate. | |
| const Type & | element (uint index) const |
| Returns read-only access to a coordinate. | |
| _CVector & | operator= (const Type &v) |
| Assigns the same value to all coordinates. | |
| bool | operator== (const _CVector &v) const |
| Compares two vectors component-wise. | |
| bool | operator!= (const _CVector &v) const |
| Returns true when vectors differ in at least one coordinate. | |
| void | operator+= (const _CVector &v) |
| Adds v component-wise. | |
| void | operator-= (const _CVector &v) |
| Subtracts v component-wise. | |
| void | operator*= (const Type &v) |
| Multiplies all coordinates by v. | |
| void | operator/= (const Type &v) |
| Divides all coordinates by v. | |
| _CVector | operator- () const |
| Returns the vector with inverted sign. | |
| _CVector | operator+ (const _CVector &v) const |
| Returns the component-wise sum with v. | |
| _CVector | operator- (const _CVector &v) const |
| Returns the component-wise difference with v. | |
| _CVector | operator* (const Type &v) const |
| Returns a copy scaled by v. | |
| _CVector | operator/ (const Type &v) const |
| Returns a copy divided by v. | |
| _CVector | cross (const _CVector &v) const |
| Returns the 3D cross product with v. | |
| Type | dot (const _CVector &v) const |
| Returns the scalar product with v. | |
| _CVector | mul (const _CVector &v) const |
| Returns the component-wise product with v. | |
| _CVector | mul (const Type &v) const |
| Returns a copy scaled by v. | |
| _CVector | div (const _CVector &v) const |
| Returns the component-wise division by v. | |
| _CVector | div (const Type &v) const |
| Returns a copy divided by v. | |
| PIMathMatrixT< 1, Size, Type > | transposed () const |
| Returns the vector as a 1 x Size matrix. | |
| Type | distToLine (const _CVector &lp0, const _CVector &lp1) |
| Returns the distance from this 2D point to the line through lp0 and lp1. | |
| template<uint Size1, typename Type1 > | |
| PIMathVectorT< Size1, Type1 > | turnTo () const |
| Converts this vector to another dimension and element type. | |
| template<typename T > | |
| PIMathVectorT< Size, T > | toType () const |
| Returns this vector with another element type. | |
| template<uint SubSize> | |
| PIMathVectorT< SubSize, Type > | subvector (int offset=0) const |
| Returns a subvector starting at offset and zero-fills coordinates outside the source range. | |
| template<uint SubSize> | |
| PIMathVectorT< Size, Type > & | setSubvector (int index, const PIMathVectorT< SubSize, Type > &v) |
| Writes v into this vector starting at index and ignores coordinates outside the destination range. | |
Static Public Member Functions | |
| static double | setPositionTolerance (const double tol) |
| Sets the default tolerance in meters. | |
| static double | getPositionTolerance () |
| Returns the default tolerance in meters. | |
| static void | convertSphericalToCartesian (const PIMathVectorT3d &tpr, PIMathVectorT3d &xyz) |
| Converts spherical coordinates to Cartesian ECEF coordinates. | |
| static void | convertCartesianToSpherical (const PIMathVectorT3d &xyz, PIMathVectorT3d &tpr) |
| Converts Cartesian ECEF coordinates to spherical coordinates. | |
| static void | convertCartesianToGeodetic (const PIMathVectorT3d &xyz, PIMathVectorT3d &llh, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Converts Cartesian ECEF coordinates to geodetic coordinates. | |
| static void | convertGeodeticToCartesian (const PIMathVectorT3d &llh, PIMathVectorT3d &xyz, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Converts geodetic coordinates to Cartesian ECEF coordinates. | |
| static void | convertCartesianToGeocentric (const PIMathVectorT3d &xyz, PIMathVectorT3d &llr) |
| Converts Cartesian ECEF coordinates to geocentric coordinates. | |
| static void | convertGeocentricToCartesian (const PIMathVectorT3d &llr, PIMathVectorT3d &xyz) |
| Converts geocentric coordinates to Cartesian ECEF coordinates. | |
| static void | convertGeocentricToGeodetic (const PIMathVectorT3d &llr, PIMathVectorT3d &llh, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Converts geocentric coordinates to geodetic coordinates. | |
| static void | convertGeodeticToGeocentric (const PIMathVectorT3d &llh, PIMathVectorT3d &llr, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Converts geodetic coordinates to geocentric coordinates. | |
| static double | radiusEarth (double geolat, PIEllipsoidModel ell=PIEllipsoidModel::WGS84Ellipsoid()) |
| Returns ellipsoid radius at the given geodetic latitude. | |
| static double | range (const PIGeoPosition &a, const PIGeoPosition &b) |
| Returns straight-line range between two positions in meters. | |
Static Public Member Functions inherited from PIMathVectorT< Size, Type > | |
| static _CVector | fromTwoPoints (const _CVector &st, const _CVector &fn) |
| Builds the displacement vector from point st to point fn. | |
| static _CVector | cross (const _CVector &v1, const _CVector &v2) |
| Returns the cross product of v1 and v2. | |
| static Type | dot (const _CVector &v1, const _CVector &v2) |
| Returns the scalar product of v1 and v2. | |
| static _CVector | mul (const _CVector &v1, const _CVector &v2) |
| Returns the component-wise product of v1 and v2. | |
| static _CVector | mul (const Type &v1, const _CVector &v2) |
| Returns v2 scaled by v1. | |
| static _CVector | mul (const _CVector &v1, const Type &v2) |
| Returns v1 scaled by v2. | |
| static _CVector | div (const _CVector &v1, const _CVector &v2) |
| Returns the component-wise division of v1 by v2. | |
| static _CVector | div (const _CVector &v1, const Type &v2) |
| Returns v1 divided by scalar v2. | |
Static Public Attributes | |
| static const double | one_cm_tolerance = 0.01 |
| One centimeter tolerance in meters. | |
| static const double | one_mm_tolerance = 0.001 |
| One millimeter tolerance in meters. | |
| static const double | one_um_tolerance = 0.000001 |
| One micron tolerance in meters. | |
| static double | position_tolerance = PIGeoPosition::one_mm_tolerance |
| Default comparison and singularity tolerance in meters. | |
Geographic position represented in one of several coordinate systems. This class provides functionality for storing and converting between different coordinate systems including geodetic, geocentric, Cartesian, and spherical coordinates. It supports various ellipsoid models for Earth representation.