Go to the documentation of this file.
25 #include "spdlog/fmt/ostr.h"
26 #include "spdlog/spdlog.h"
39 #define AD_PHYSICS_ANGLE_THROWS_EXCEPTION 1
41 #if SAFE_DATATYPES_EXPLICIT_CONVERSION
45 #define _AD_PHYSICS_ANGLE_EXPLICIT_CONVERSION_ explicit
50 #define _AD_PHYSICS_ANGLE_EXPLICIT_CONVERSION_
85 : mAngle(std::numeric_limits<double>::quiet_NaN())
166 return (mAngle > other.mAngle) &&
operator!=(other);
182 return (mAngle < other.mAngle) &&
operator!=(other);
198 return ((mAngle > other.mAngle) ||
operator==(other));
214 return ((mAngle < other.mAngle) ||
operator==(other));
231 Angle const result(mAngle + other.mAngle);
250 mAngle += other.mAngle;
269 Angle const result(mAngle - other.mAngle);
288 mAngle -= other.mAngle;
306 Angle const result(mAngle * scalar);
323 Angle const scalarAngle(scalar);
324 Angle const result(
operator/(scalarAngle));
344 double const result = mAngle / other.mAngle;
359 Angle const result(-mAngle);
384 auto const valueClass = std::fpclassify(mAngle);
385 return ((valueClass == FP_NORMAL) || (valueClass == FP_ZERO)) && (
cMinValue <= mAngle) && (mAngle <=
cMaxValue);
398 spdlog::info(
"ensureValid(::ad::physics::Angle)>> {} value out of range", *
this);
399 #if (AD_PHYSICS_ANGLE_THROWS_EXCEPTION == 1)
400 throw std::out_of_range(
"Angle value out of range");
414 if (
operator==(
Angle(0.)))
416 spdlog::info(
"ensureValid(::ad::physics::Angle)>> {} value is zero", *
this);
417 #if (AD_PHYSICS_ANGLE_THROWS_EXCEPTION == 1)
418 throw std::out_of_range(
"Angle value is zero");
469 return value.operator*(other);
480 inline ::ad::physics::Angle
fabs(const ::ad::physics::Angle other)
500 static inline ::ad::physics::Angle
lowest()
502 return ::ad::physics::Angle::getMin();
507 static inline ::ad::physics::Angle
max()
509 return ::ad::physics::Angle::getMax();
517 return ::ad::physics::Angle::getPrecision();
526 #ifndef GEN_GUARD_AD_PHYSICS_ANGLE
527 #define GEN_GUARD_AD_PHYSICS_ANGLE
548 return os << double(_value);
560 return to_string(
static_cast<double>(value));
563 #endif // GEN_GUARD_AD_PHYSICS_ANGLE
namespace ad
Definition: Acceleration.hpp:30
static Angle getMin()
get minimum valid Angle (i.e. cMinValue)
Definition: Angle.hpp:426
static inline ::ad::physics::Angle epsilon()
Definition: Angle.hpp:515
DataType Angle.
Definition: Angle.hpp:59
Angle operator-() const
standard arithmetic operator
Definition: Angle.hpp:356
bool isValid() const
Definition: Angle.hpp:382
static inline ::ad::physics::Angle lowest()
Definition: Angle.hpp:500
Angle()
default constructor
Definition: Angle.hpp:84
static Angle getMax()
get maximum valid Angle (i.e. cMaxValue)
Definition: Angle.hpp:434
Angle operator/(const double &scalar) const
standard arithmetic operator
Definition: Angle.hpp:321
static const double cMaxValue
constant defining the maximum valid Angle value (used in isValid())
Definition: Angle.hpp:70
bool operator<=(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:210
Angle operator-(const Angle &other) const
standard arithmetic operator
Definition: Angle.hpp:265
Angle operator*(const double &scalar) const
standard arithmetic operator
Definition: Angle.hpp:303
void ensureValidNonZero() const
ensure that the Angle is valid and non zero
Definition: Angle.hpp:411
#define _AD_PHYSICS_ANGLE_EXPLICIT_CONVERSION_
Enable/Disable explicit conversion. Currently set to "implicit conversion allowed".
Definition: Angle.hpp:50
bool operator!=(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:148
bool operator==(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:134
bool operator<(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:178
void ensureValid() const
ensure that the Angle is valid
Definition: Angle.hpp:394
static const double cPrecisionValue
constant defining the assumed Angle value accuracy (used in comparison operator==(),...
Definition: Angle.hpp:76
_AD_PHYSICS_ANGLE_EXPLICIT_CONVERSION_ Angle(double const iAngle)
standard constructor
Definition: Angle.hpp:94
Angle & operator+=(const Angle &other)
standard arithmetic operator
Definition: Angle.hpp:246
Angle & operator=(const Angle &other)=default
standard assignment operator
bool operator>(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:162
inline ::ad::physics::Weight fabs(const ::ad::physics::Weight other)
overload of the std::fabs for Weight
Definition: Weight.hpp:480
inline ::ad::physics::Acceleration fabs(const ::ad::physics::Acceleration other)
overload of the std::fabs for Acceleration
Definition: Acceleration.hpp:481
std::string to_string(::ad::physics::Acceleration const &value)
overload of the std::to_string for Acceleration
Definition: Acceleration.hpp:559
static inline ::ad::physics::Angle max()
Definition: Angle.hpp:507
static const double cMinValue
constant defining the minimum valid Angle value (used in isValid())
Definition: Angle.hpp:65
Angle operator+(const Angle &other) const
standard arithmetic operator
Definition: Angle.hpp:227
Angle operator-=(const Angle &other)
standard arithmetic operator
Definition: Angle.hpp:284
std::ostream & operator<<(std::ostream &os, Acceleration const &_value)
standard ostream operator
Definition: Acceleration.hpp:547
bool operator>=(const Angle &other) const
standard comparison operator
Definition: Angle.hpp:194
inline ::ad::physics::Angle operator*(const double &other, ::ad::physics::Angle const &value)
standard arithmetic operator
Definition: Angle.hpp:467
static Angle getPrecision()
get assumed accuracy of Angle (i.e. cPrecisionValue)
Definition: Angle.hpp:442
double operator/(const Angle &other) const
standard arithmetic operator
Definition: Angle.hpp:340