The CoordinateVector3 class represents the vector containing 3 coordinates, either metric or spherical. More...
#include <gz/math/CoordinateVector3.hh>
Public Member Functions | |
CoordinateVector3 () | |
Construct an empty metric vector. | |
CoordinateVector3 (const CoordinateVector3 &_other) | |
Copy constructor. | |
CoordinateVector3 (CoordinateVector3 &&_other) noexcept | |
~CoordinateVector3 () | |
std::optional< math::Vector3d > | AsMetricVector () const |
Return this vector as a metric Vector3d (only valid for metric). | |
bool | Equal (const CoordinateVector3 &_v) const |
Equality test. | |
bool | Equal (const CoordinateVector3 &_v, const double &_tol, const math::Angle &_ang_tol) const |
Equality test with tolerance. | |
bool | IsFinite () const |
See if all vector components are finite (e.g., not nan) | |
bool | IsMetric () const |
Whether this vector is metric. | |
bool | IsSpherical () const |
Whether this vector is spherical. | |
std::optional< math::Angle > | Lat () const |
Get the latitude of a spherical vector. | |
bool | Lat (const Angle &_v) |
Set the latitude. | |
std::optional< math::Angle > | Lon () const |
Get the longitude of a spherical vector. | |
bool | Lon (const Angle &_v) |
Set the longitude. | |
bool | operator!= (const CoordinateVector3 &_v) const |
Not equal to operator. | |
CoordinateVector3 | operator+ (const CoordinateVector3 &_v) const |
Addition operator. | |
const CoordinateVector3 & | operator+= (const CoordinateVector3 &_v) |
Addition assignment operator. | |
CoordinateVector3 | operator- () const |
Negation operator. | |
CoordinateVector3 | operator- (const CoordinateVector3 &_pt) const |
Subtraction operators. | |
const CoordinateVector3 & | operator-= (const CoordinateVector3 &_pt) |
Subtraction assignment operators. | |
CoordinateVector3 & | operator= (const CoordinateVector3 &_other) |
Copy assignment. | |
CoordinateVector3 & | operator= (CoordinateVector3 &&_other) noexcept |
Move assignment. | |
bool | operator== (const CoordinateVector3 &_v) const |
Equal to operator. | |
void | SetMetric (const math::Vector3d &_v) |
Set the metric contents of the vector. | |
void | SetMetric (double _x, double _y, double _z) |
Set the metric contents of the vector. | |
void | SetSpherical (const math::Angle &_lat, const math::Angle &_lon, double _z) |
Set the spherical contents of the vector. | |
std::optional< double > | X () const |
Get the x value of a metric vector. | |
bool | X (const double &_v) |
Set the x value. | |
std::optional< double > | Y () const |
Get the y value of a metric vector. | |
bool | Y (const double &_v) |
Set the y value. | |
std::optional< double > | Z () const |
Get the z value. | |
bool | Z (const double &_v) |
Set the z value. | |
Static Public Member Functions | |
static CoordinateVector3 | Metric (const math::Vector3d &_v) |
Constructor for metric values. | |
static CoordinateVector3 | Metric (double _x, double _y, double _z) |
Constructor for metric values. | |
static CoordinateVector3 | Spherical (const math::Angle &_lat, const math::Angle &_lon, double _z) |
Constructor for spherical values. | |
Detailed Description
The CoordinateVector3 class represents the vector containing 3 coordinates, either metric or spherical.
Constructor & Destructor Documentation
◆ CoordinateVector3() [1/3]
Construct an empty metric vector.
◆ ~CoordinateVector3()
~CoordinateVector3 | ( | ) |
◆ CoordinateVector3() [2/3]
CoordinateVector3 | ( | const CoordinateVector3 & | _other | ) |
Copy constructor.
- Parameters
-
[in] _other The copied value.
◆ CoordinateVector3() [3/3]
|
noexcept |
Member Function Documentation
◆ AsMetricVector()
std::optional< math::Vector3d > AsMetricVector | ( | ) | const |
Return this vector as a metric Vector3d (only valid for metric).
- Returns
- The metric vector (or nullopt if the vector is not metric).
◆ Equal() [1/2]
bool Equal | ( | const CoordinateVector3 & | _v | ) | const |
Equality test.
- Remarks
- This is equivalent to the == operator
- Parameters
-
[in] _v the other vector
- Returns
- true if the 2 vectors have the same values, false otherwise
◆ Equal() [2/2]
bool Equal | ( | const CoordinateVector3 & | _v, |
const double & | _tol, | ||
const math::Angle & | _ang_tol | ||
) | const |
Equality test with tolerance.
- Parameters
-
[in] _v the vector to compare to [in] _tol equality tolerance for metric components. [in] _ang_tol equality tolerance for spherical components.
- Returns
- true if the vectors are equal within the tolerance specified by _tol and _ang_tol.
◆ IsFinite()
bool IsFinite | ( | ) | const |
See if all vector components are finite (e.g., not nan)
- Returns
- true if is finite or false otherwise
◆ IsMetric()
bool IsMetric | ( | ) | const |
Whether this vector is metric.
- Returns
- Whether this vector is metric.
◆ IsSpherical()
bool IsSpherical | ( | ) | const |
Whether this vector is spherical.
- Returns
- Whether this vector is spherical.
◆ Lat() [1/2]
std::optional< math::Angle > Lat | ( | ) | const |
Get the latitude of a spherical vector.
- Returns
- The latitude of the spherical vector (or nullopt if metric).
◆ Lat() [2/2]
Set the latitude.
- Parameters
-
[in] _v Value for the latitude.
- Returns
- True if the vector is spherical, false otherwise.
◆ Lon() [1/2]
std::optional< math::Angle > Lon | ( | ) | const |
Get the longitude of a spherical vector.
- Returns
- The longitude of the spherical vector (or nullopt if metric).
◆ Lon() [2/2]
Set the longitude.
- Parameters
-
[in] _v Value for the longitude.
- Returns
- True if the vector is spherical, false otherwise.
◆ Metric() [1/2]
|
static |
Constructor for metric values.
- Parameters
-
[in] _v The metric vector.
- Returns
- The coordinate vector.
◆ Metric() [2/2]
|
static |
Constructor for metric values.
- Parameters
-
[in] _x value along x [in] _y value along y [in] _z value along z
- Returns
- The coordinate vector.
◆ operator!=()
bool operator!= | ( | const CoordinateVector3 & | _v | ) | const |
Not equal to operator.
- Parameters
-
[in] _v The vector to compare against
- Returns
- false if the vectors are not equal within a default tolerance (1e-3), true otherwise
◆ operator+()
CoordinateVector3 operator+ | ( | const CoordinateVector3 & | _v | ) | const |
Addition operator.
- Parameters
-
[in] _v vector to add
- Returns
- the sum vector
- Note
- If one vector is metric and the other is spherical, a NaN vector will be returned and a message logged to cerr.
◆ operator+=()
const CoordinateVector3 & operator+= | ( | const CoordinateVector3 & | _v | ) |
Addition assignment operator.
- Parameters
-
[in] _v vector to add
- Returns
- the sum vector
- Note
- If one vector is metric and the other is spherical, a NaN vector will be set and a message logged to cerr.
◆ operator-() [1/2]
CoordinateVector3 operator- | ( | ) | const |
Negation operator.
- Returns
- negative of this vector
◆ operator-() [2/2]
CoordinateVector3 operator- | ( | const CoordinateVector3 & | _pt | ) | const |
Subtraction operators.
- Parameters
-
[in] _pt a vector to subtract
- Returns
- a vector after the subtraction
- Note
- If one vector is metric and the other is spherical, a NaN vector will be returned and a message logged to cerr.
◆ operator-=()
const CoordinateVector3 & operator-= | ( | const CoordinateVector3 & | _pt | ) |
Subtraction assignment operators.
- Parameters
-
[in] _pt subtrahend
- Returns
- a vector after the subtraction
- Note
- If one vector is metric and the other is spherical, a NaN vector will be set and a message logged to cerr.
◆ operator=() [1/2]
CoordinateVector3 & operator= | ( | const CoordinateVector3 & | _other | ) |
Copy assignment.
- Parameters
-
[in] _other The copied value.
- Returns
- Reference to this.
◆ operator=() [2/2]
|
noexcept |
Move assignment.
- Parameters
-
[in] _other The copied value.
- Returns
- Reference to this.
◆ operator==()
bool operator== | ( | const CoordinateVector3 & | _v | ) | const |
Equal to operator.
- Parameters
-
[in] _v The vector to compare against
- Returns
- true if the vectors are equal within a default tolerance (1e-3), false otherwise
◆ SetMetric() [1/2]
void SetMetric | ( | const math::Vector3d & | _v | ) |
Set the metric contents of the vector.
- Parameters
-
[in] _v The metric vector.
◆ SetMetric() [2/2]
Set the metric contents of the vector.
- Parameters
-
[in] _x value along x [in] _y value along y [in] _z value aling z
◆ SetSpherical()
void SetSpherical | ( | const math::Angle & | _lat, |
const math::Angle & | _lon, | ||
double | _z | ||
) |
Set the spherical contents of the vector.
- Parameters
-
[in] _lat latitude value [in] _lon longitude value [in] _z value along z
◆ Spherical()
|
static |
Constructor for spherical values.
- Parameters
-
[in] _lat latitude value [in] _lon longitude value [in] _z value along z
- Returns
- The coordinate vector.
◆ X() [1/2]
std::optional< double > X | ( | ) | const |
Get the x value of a metric vector.
- Returns
- The x component of the metric vector (or nullopt if spherical).
◆ X() [2/2]
Set the x value.
- Parameters
-
[in] _v Value for the x component.
- Returns
- True if the vector is metric, false otherwise.
◆ Y() [1/2]
std::optional< double > Y | ( | ) | const |
Get the y value of a metric vector.
- Returns
- The y component of the metric vector (or nullopt if spherical).
◆ Y() [2/2]
Set the y value.
- Parameters
-
[in] _v Value for the y component.
- Returns
- True if the vector is metric, false otherwise.
◆ Z() [1/2]
std::optional< double > Z | ( | ) | const |
Get the z value.
- Returns
- The z component of the vector (nullopt is never returned).
◆ Z() [2/2]
Set the z value.
- Parameters
-
[in] _v Value for the z component.
- Returns
- Always true.
The documentation for this class was generated from the following file: