5namespace state_representation::units {
8inline namespace literals {
14constexpr Distance
operator ""_m(
long double n);
21constexpr Distance
operator ""_km(
long double n);
28constexpr Distance
operator ""_dm(
long double n);
35constexpr Distance
operator ""_cm(
long double n);
42constexpr Distance
operator ""_mm(
long double n);
54 constexpr Distance(
long double n = 0.0);
192 friend constexpr Distance literals::operator
""_m(
long double n);
199 friend constexpr Distance literals::operator
""_km(
long double n);
206 friend constexpr Distance literals::operator
""_dm(
long double n);
213 friend constexpr Distance literals::operator
""_cm(
long double n);
220 friend constexpr Distance literals::operator
""_mm(
long double n);
234 this->value = -this->value;
239 this->value = this->value + rhs.value;
250 this->value = this->value - rhs.value;
261 this->value = this->value * lambda;
272 this->value = this->value / lambda;
283 return (abs(this->value - rhs.value) < 1e-4);
287 return !((*this) == rhs);
291 return ((this->value - rhs.value) > 1e-4);
295 return (((*
this) > rhs) or ((*
this) == rhs));
299 return ((rhs.value - this->value) > 1e-4);
303 return (((*
this) < rhs) or ((*
this) == rhs));
311 return Distance(lambda * rhs.value);
314inline namespace literals {
315constexpr Distance operator ""_m(
long double n) {
319constexpr Distance
operator ""_km(
long double n) {
320 return Distance(1e3 * n);
323constexpr Distance
operator ""_dm(
long double n) {
324 return Distance(1e-1 * n);
327constexpr Distance
operator ""_cm(
long double n) {
328 return Distance(1e-2 * n);
331constexpr Distance
operator ""_mm(
long double n) {
332 return Distance(1e-3 * n);
constexpr Distance & operator*=(double lambda)
Overload the *= operator with a scalar.
constexpr Distance & operator+=(const Distance &rhs)
Overload the += operator.
constexpr Distance & operator/=(double lambda)
Overload the /= operator with a scalar.
constexpr Distance operator+(const Distance &rhs) const
Overload the + operator.
constexpr bool operator>(const Distance &rhs) const
Overload the > operator.
constexpr Distance & operator-()
Overload the - operator.
constexpr bool operator<=(const Distance &rhs) const
Overload the < operator.
constexpr bool operator!=(const Distance &rhs) const
Overload the != operator.
constexpr Distance(long double n=0.0)
Constructor with a value in meter.
constexpr Distance & operator-=(const Distance &rhs)
Overload the -= operator.
constexpr long double get_value() const
Getter of the value attribute.
constexpr bool operator<(const Distance &rhs) const
Overload the < operator.
constexpr bool operator>=(const Distance &rhs) const
Overload the > operator.
friend constexpr Distance operator*(double lambda, const Distance &rhs)
Overload the / operator with a scalar on the left side.
friend constexpr double operator/(const Distance &lhs, const Distance &rhs)
Overload the / operator between two distances.
constexpr bool operator==(const Distance &rhs) const
Overload the == operator.
double dist(const CartesianState &s1, const CartesianState &s2, const CartesianStateVariable &state_variable_type=CartesianStateVariable::ALL)
Compute the distance between two Cartesian states.