5namespace state_representation::units {
8inline namespace literals {
14constexpr Angle
operator ""_rad(
long double n);
21constexpr Angle
operator ""_deg(
long double n);
33 constexpr Angle(
long double n = 0.0);
178 friend constexpr Angle literals::operator
""_rad(
long double n);
185 friend constexpr Angle literals::operator
""_deg(
long double n);
189 value(atan2(sin(n), cos(n))) {}
199 this->value = atan2(sin(n), cos(n));
204 this->value = -this->value;
209 double n = this->value + rhs.value;
210 this->value = atan2(sin(n), cos(n));
221 double n = this->value - rhs.value;
222 this->value = atan2(sin(n), cos(n));
233 double n = this->value * lambda;
234 this->value = atan2(sin(n), cos(n));
245 double n = this->value / lambda;
246 this->value = atan2(sin(n), cos(n));
257 return (abs(this->value - rhs.value) < 1e-4);
261 return !((*this) == rhs);
265 return ((this->value - rhs.value) > 1e-4);
269 return (((*
this) > rhs) or ((*
this) == rhs));
273 return ((rhs.value - this->value) > 1e-4);
277 return (((*
this) < rhs) or ((*
this) == rhs));
280constexpr double operator/(
const Angle& lhs,
const Angle& rhs) {
285 return Angle(lambda * rhs.value);
288inline namespace literals {
289constexpr Angle operator ""_rad(
long double n) {
293constexpr Angle
operator ""_deg(
long double n) {
294 return Angle(M_PI * n / 180);
constexpr long double get_value() const
Getter of the value attribute.
friend constexpr Angle operator*(double lambda, const Angle &rhs)
Overload the / operator with a scalar on the left side.
constexpr Angle & operator=(long double n)
Overload the = operator.
constexpr bool operator>(const Angle &rhs) const
Overload the > operator.
constexpr Angle & operator-()
Overload the - operator.
constexpr Angle(long double n=0.0)
Constructor with a value in radian in [-pi,pi].
constexpr Angle & operator+=(const Angle &rhs)
Overload the += operator.
constexpr bool operator!=(const Angle &rhs) const
Overload the != operator.
constexpr Angle & operator/=(double lambda)
Overload the /= operator with a scalar.
constexpr Angle operator+(const Angle &rhs) const
Overload the + operator.
constexpr bool operator<(const Angle &rhs) const
Overload the < operator.
constexpr bool operator>=(const Angle &rhs) const
Overload the > operator.
constexpr bool operator==(const Angle &rhs) const
Overload the == operator.
constexpr Angle & operator-=(const Angle &rhs)
Overload the -= operator.
constexpr Angle & operator*=(double lambda)
Overload the *= operator with a scalar.
friend constexpr double operator/(const Angle &lhs, const Angle &rhs)
Overload the / operator between two Angles.
constexpr bool operator<=(const Angle &rhs) const
Overload the < operator.