Convert spherical coordinates for planetary surfaces. More...
#include <commmon/common.hh>
Public Types | |
enum | CoordinateType { SPHERICAL = 1 , ECEF = 2 , GLOBAL = 3 , LOCAL = 4 } |
Unique identifiers for coordinate types. More... | |
enum | SurfaceType { EARTH_WGS84 = 1 } |
Unique identifiers for planetary surface models. More... | |
Public Member Functions | |
SphericalCoordinates () | |
Constructor. | |
SphericalCoordinates (const SphericalCoordinates &_sc) | |
Copy constructor. | |
SphericalCoordinates (const SurfaceType _type) | |
Constructor with surface type input. | |
SphericalCoordinates (const SurfaceType _type, const ignition::math::Angle &_latitude, const ignition::math::Angle &_longitude, const double _elevation, const ignition::math::Angle &_heading) | |
Constructor with surface type, angle, and elevation inputs. | |
~SphericalCoordinates () | |
Destructor. | |
double | ElevationReference () const |
Get reference elevation in meters. | |
ignition::math::Vector3d | GlobalFromLocalVelocity (const ignition::math::Vector3d &_xyz) const |
Convert a Cartesian velocity vector in the local frame to a global Cartesian frame with components East, North, Up. | |
ignition::math::Angle | HeadingOffset () const |
Get heading offset for the reference frame, expressed as angle from East to x-axis, or equivalently from North to y-axis. | |
ignition::math::Angle | LatitudeReference () const |
Get reference geodetic latitude. | |
ignition::math::Vector3d | LocalFromGlobalVelocity (const ignition::math::Vector3d &_xyz) const |
Convert a Cartesian velocity vector with components East, North, Up to a local cartesian frame vector XYZ. | |
ignition::math::Vector3d | LocalFromSphericalPosition (const ignition::math::Vector3d &_xyz) const |
Convert a geodetic position vector to Cartesian coordinates. | |
ignition::math::Angle | LongitudeReference () const |
Get reference longitude. | |
bool | operator!= (const SphericalCoordinates &_sc) const |
Inequality. | |
SphericalCoordinates & | operator= (const SphericalCoordinates &_sc) |
Assignment operator. | |
bool | operator== (const SphericalCoordinates &_sc) const |
Equality operator, result = this == _sc. | |
ignition::math::Vector3d | PositionTransform (const ignition::math::Vector3d &_pos, const CoordinateType &_in, const CoordinateType &_out) const |
Convert between positions in SPHERICAL/ECEF/LOCAL/GLOBAL frame. | |
void | SetElevationReference (const double _elevation) |
Set reference elevation above sea level in meters. | |
void | SetHeadingOffset (const ignition::math::Angle &_angle) |
Set heading angle offset for the frame. | |
void | SetLatitudeReference (const ignition::math::Angle &_angle) |
Set reference geodetic latitude. | |
void | SetLongitudeReference (const ignition::math::Angle &_angle) |
Set reference longitude. | |
void | SetSurface (const SurfaceType &_type) |
Set SurfaceType for planetary surface model. | |
ignition::math::Vector3d | SphericalFromLocalPosition (const ignition::math::Vector3d &_xyz) const |
Convert a Cartesian position vector to geodetic coordinates. | |
SurfaceType | Surface () const |
Get SurfaceType currently in use. | |
void | UpdateTransformationMatrix () |
Update coordinate transformation matrix with reference location. | |
ignition::math::Vector3d | VelocityTransform (const ignition::math::Vector3d &_vel, const CoordinateType &_in, const CoordinateType &_out) const |
Convert between velocity in SPHERICAL/ECEF/LOCAL/GLOBAL frame. | |
Static Public Member Functions | |
static SurfaceType | Convert (const std::string &_str) |
Convert a string to a SurfaceType. | |
static double | Distance (const ignition::math::Angle &_latA, const ignition::math::Angle &_lonA, const ignition::math::Angle &_latB, const ignition::math::Angle &_lonB) |
Get the distance between two points expressed in geographic latitude and longitude. | |
Convert spherical coordinates for planetary surfaces.
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SphericalCoordinates | ( | ) |
Constructor.
|
explicit |
Constructor with surface type input.
[in] | _type | SurfaceType specification. |
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SphericalCoordinates | ( | const SurfaceType | _type, |
const ignition::math::Angle & | _latitude, | ||
const ignition::math::Angle & | _longitude, | ||
const double | _elevation, | ||
const ignition::math::Angle & | _heading ) |
Constructor with surface type, angle, and elevation inputs.
[in] | _type | SurfaceType specification. |
[in] | _latitude | Reference latitude. |
[in] | _longitude | Reference longitude. |
[in] | _elevation | Reference elevation. |
[in] | _heading | Heading offset. |
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SphericalCoordinates | ( | const SphericalCoordinates & | _sc | ) |
Copy constructor.
[in] | _sc | Spherical coordinates to copy. |
ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::~SphericalCoordinates | ( | ) |
Destructor.
|
static |
Convert a string to a SurfaceType.
Allowed values: ["EARTH_WGS84"].
[in] | _str | String to convert. |
|
static |
Get the distance between two points expressed in geographic latitude and longitude.
It assumes that both points are at sea level. Example: _latA = 38.0016667 and _lonA = -123.0016667) represents the point with latitude 38d 0'6.00"N and longitude 123d 0'6.00"W.
[in] | _latA | Latitude of point A. |
[in] | _longA | Longitude of point A. |
[in] | _latB | Latitude of point B. |
[in] | _longB | Longitude of point B. |
double ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::ElevationReference | ( | ) | const |
Get reference elevation in meters.
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::GlobalFromLocalVelocity | ( | const ignition::math::Vector3d & | _xyz | ) | const |
Convert a Cartesian velocity vector in the local frame to a global Cartesian frame with components East, North, Up.
[in] | _xyz | Cartesian velocity vector in the world frame. |
ignition::math::Angle ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::HeadingOffset | ( | ) | const |
Get heading offset for the reference frame, expressed as angle from East to x-axis, or equivalently from North to y-axis.
ignition::math::Angle ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::LatitudeReference | ( | ) | const |
Get reference geodetic latitude.
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::LocalFromGlobalVelocity | ( | const ignition::math::Vector3d & | _xyz | ) | const |
Convert a Cartesian velocity vector with components East, North, Up to a local cartesian frame vector XYZ.
[in] | Vector | with components (x,y,z): (East, North, Up). |
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::LocalFromSphericalPosition | ( | const ignition::math::Vector3d & | _xyz | ) | const |
Convert a geodetic position vector to Cartesian coordinates.
[in] | _xyz | Geodetic position in the planetary frame of reference |
ignition::math::Angle ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::LongitudeReference | ( | ) | const |
Get reference longitude.
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::operator!= | ( | const SphericalCoordinates & | _sc | ) | const |
Inequality.
[in] | _sc | Spherical coordinates to check for inequality |
SphericalCoordinates & ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::operator= | ( | const SphericalCoordinates & | _sc | ) |
Assignment operator.
[in] | _sc | The spherical coordinates to copy from. |
bool ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::operator== | ( | const SphericalCoordinates & | _sc | ) | const |
Equality operator, result = this == _sc.
[in] | _sc | Spherical coordinates to check for equality |
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::PositionTransform | ( | const ignition::math::Vector3d & | _pos, |
const CoordinateType & | _in, | ||
const CoordinateType & | _out ) const |
Convert between positions in SPHERICAL/ECEF/LOCAL/GLOBAL frame.
[in] | _pos | Position vector in frame defined by parameter _in |
[in] | _in | CoordinateType for input |
[in] | _out | CoordinateType for output |
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SetElevationReference | ( | const double | _elevation | ) |
Set reference elevation above sea level in meters.
[in] | _elevation | Reference elevation. |
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SetHeadingOffset | ( | const ignition::math::Angle & | _angle | ) |
Set heading angle offset for the frame.
[in] | _angle | Heading offset for the frame. |
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SetLatitudeReference | ( | const ignition::math::Angle & | _angle | ) |
Set reference geodetic latitude.
[in] | _angle | Reference geodetic latitude. |
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SetLongitudeReference | ( | const ignition::math::Angle & | _angle | ) |
Set reference longitude.
[in] | _angle | Reference longitude. |
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SetSurface | ( | const SurfaceType & | _type | ) |
Set SurfaceType for planetary surface model.
[in] | _type | SurfaceType value. |
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::SphericalFromLocalPosition | ( | const ignition::math::Vector3d & | _xyz | ) | const |
Convert a Cartesian position vector to geodetic coordinates.
[in] | _xyz | Cartesian position vector in the world frame. |
SurfaceType ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::Surface | ( | ) | const |
Get SurfaceType currently in use.
void ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::UpdateTransformationMatrix | ( | ) |
Update coordinate transformation matrix with reference location.
ignition::math::Vector3d ignition::math::IGNITION_MATH_VERSION_NAMESPACE::SphericalCoordinates::VelocityTransform | ( | const ignition::math::Vector3d & | _vel, |
const CoordinateType & | _in, | ||
const CoordinateType & | _out ) const |
Convert between velocity in SPHERICAL/ECEF/LOCAL/GLOBAL frame.
[in] | _vel | Velocity vector in frame defined by parameter _in |
[in] | _in | CoordinateType for input |
[in] | _out | CoordinateType for output |