The geo location class.
More...
#include <murl_util_geo_location.h>
|
Double | mLatitude |
| The latitude in degrees relative to the equator.
|
|
Double | mLongitude |
| The longitude in degrees relative to the zero meridian.
|
|
Double | mAltitude |
| The altitude above sea level in meters.
|
|
Double | mRadius |
| The sphere radius in meters, default is the idealized earth radius of 6371000 meters.
|
|
◆ GeoLocation()
Murl::Util::GeoLocation::GeoLocation |
( |
Double |
latitude, |
|
|
Double |
longitude, |
|
|
Double |
altitude |
|
) |
| |
The constructor taking separate location values.
- Parameters
-
latitude | The latitude in degrees relative to the equator. |
longitude | The longitude in degrees relative to the zero meridian. |
altitude | The altitude above sea level in meters. |
◆ GetRotationMatrix()
Get the rotation matrix from acceleration and geomagnetic values.
- Parameters
-
acceleration | The acceleration vector. |
geomagnetic | The geomagnetic field vector. |
- Returns
- The rotation matrix.
◆ GetRotationAngles()
static Vector Murl::Util::GeoLocation::GetRotationAngles |
( |
const Matrix & |
rotation | ) |
|
|
static |
Get the geo rotation angles from a rotation matrix.
Extracts the following rotation angles:
- Sets the vector member x to the pitch angle.
- Sets the vector member y to the roll angle.
- Sets the vector member z to the azimuth angle.
- Parameters
-
- Returns
- The geo rotation angles in radiants.
◆ IsZero()
Bool Murl::Util::GeoLocation::IsZero |
( |
| ) |
const |
Check if the location is zero.
- Returns
- true if all location members are zero.
◆ GetDistance()
Calculate the distance from this location to a geo location.
The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes. The altitude is not considered.
The calculation uses the simple spherical law of cosines formula.
distance = acos(sin(φ1) * sin(φ2) + cos(φ1) * cos(φ2) * cos(Δλ)) * earth radius.
- Parameters
-
location | The geo location. |
- Returns
- The distance to the geo location in meters.
◆ GetBearing()
Calculate the bearing angle between this and a geo locations.
The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes. The altitude is not considered.
The formula is for the initial bearing (sometimes referred to as forward azimuth) which if followed in a straight line along a great circle arc will take you from the start point to the end point.
θ = atan2(sin(Δλ) * cos(φ2), cos(φ1) * sin(φ2) − sin(φ1) * cos(φ2) * cos(Δλ)).
- Parameters
-
location | The geo location. |
- Returns
- The bearing angle between this and the geo location in degrees in range [0 .. 360).
◆ GetDestination()
Calculate the destination geo location by a given distance and bearing from this location.
The formula calculates on the basis of a spherical earth (ignoring ellipsoidal effects) which is accurate enough for most purposes.
Given a start point, initial bearing, and distance, this will calculate the destination point travelling along a great circle arc.
φ2 = asin(sin(φ1) * cos(d / R) + cos(φ1) * sin(d / R) * cos(θ))
λ2 = λ1 + atan2(sin(θ) * sin(d / R) * cos(φ1), cos(d / R) − sin(φ1) * sin(φ2))
φ is latitude, λ is longitude, θ is the bearing (clockwise from north), d is the distance, R is the earth’s radius (d / R is the angular distance).
- Parameters
-
distance | The distance to the destination geo location in meters. |
bearing | The bearing to the destination geo location in degrees. |
- Returns
- The destination geo location including the altitude from this location.
The documentation for this class was generated from the following file: