Represents a geodetic GPS coordinate with latitude, longitude, and optional altitude.
More...
|
|
| GPSCoordinate (float lat, float lon, float alt=0) |
| |
|
bool | isValid () const |
| | Check if the values are valid.
|
| |
|
| operator bool () const |
| | Check if the values are valid.
|
| |
|
float | distance (const GPSCoordinate &other, DistanceUnit unit=DistanceUnit::M) const |
| | Calculate distance to other GPS coordinate.
|
| |
| float | bearing (const GPSCoordinate &other, AngleUnit unit=AngleUnit::DEG) const |
| |
| float | elevation (const GPSCoordinate &other, AngleUnit unit=AngleUnit::DEG) const |
| |
| float | altitudeDifference (const GPSCoordinate &other) const |
| |
|
GPSCoordinate | navigate (Distance distance, Angle bearing, Distance altDiff) const |
| | Calculate a new GPS coordinate given a distance (in meters) and bearing.
|
| |
|
GPSCoordinate | navigate (float distance_m, float bearing_deg, float alt_diff_m=0) const |
| | Calculate a new GPS coordinate given a distance (in meters) and bearing.
|
| |
| bool | equals (const GPSCoordinate &other, float limit) const |
| |
| bool | equalsWithAltitude (const GPSCoordinate &other, float limit, float altLimit) const |
| |
|
std::string | toString () const |
| | Serialize GPS coordinate to string representation.
|
| |
| bool | fromString (const std::string &str) |
| |
|
const char * | getTypeName () const |
| |
Represents a geodetic GPS coordinate with latitude, longitude, and optional altitude.
The GPSCoordinate class encapsulates a single point on Earth using WGS84 latitude and longitude (in degrees), and optional altitude (in meters). It provides methods for:
- Calculating geodesic distance and bearing to another coordinate (using the haversine formula)
- Computing elevation angle and altitude difference
- Navigating to a new coordinate given a distance and bearing (great-circle navigation)
- Comparing coordinates with a specified tolerance (for proximity checks)
- Serializing/deserializing to and from string representations for storage or transmission
Fields:
- latitude: WGS84 latitude in degrees (-90 to 90)
- longitude: WGS84 longitude in degrees (-180 to 180)
- altitude: Altitude above ellipsoid in meters (optional)
Usage:
Example: GPSCoordinate a(48.8584, 2.2945, 35); // Eiffel Tower GPSCoordinate b(51.5007, -0.1246, 15); // London float dist = a.distance(b); // meters float brng = a.bearing(b); // degrees GPSCoordinate c = a.navigate(1000, 90); // 1km east
This class is suitable for robotics, mapping, navigation, and geospatial applications on embedded or desktop systems.