ARGoS
3
A parallel, multi-engine simulator for swarm robotics
|
Go to the documentation of this file.
24 #include <argos3/core/utility/datatypes/datatypes.h>
25 #include <argos3/core/utility/math/general.h>
26 #include <argos3/core/utility/math/range.h>
32 #define ARGOS_PI 3.14159265358979323846264338327950288
120 return Abs(m_fValue);
154 m_fValue = -m_fValue;
167 m_fValue += c_radians.m_fValue;
172 m_fValue -= c_radians.m_fValue;
188 cResult += c_radians;
194 cResult -= c_radians;
212 return m_fValue / c_radians.m_fValue;
222 return m_fValue < c_radians.m_fValue;
226 return m_fValue <= c_radians.m_fValue;
230 return m_fValue > c_radians.m_fValue;
234 return m_fValue >= c_radians.m_fValue;
238 return m_fValue == c_radians.m_fValue;
242 return m_fValue != c_radians.m_fValue;
257 << c_radians.m_fValue
267 is >> c_radians.m_fValue;
315 m_fValue = f_value / DEGREES_TO_RADIANS;
331 return Abs(m_fValue);
348 SIGNED_RANGE.WrapValue(*
this);
358 UNSIGNED_RANGE.WrapValue(*
this);
371 m_fValue += c_degrees.m_fValue;
376 m_fValue -= c_degrees.m_fValue;
392 cResult += c_degrees;
398 cResult -= c_degrees;
416 return m_fValue / c_degrees.m_fValue;
426 return m_fValue < c_degrees.m_fValue;
430 return m_fValue <= c_degrees.m_fValue;
434 return m_fValue > c_degrees.m_fValue;
438 return m_fValue >= c_degrees.m_fValue;
442 return m_fValue == c_degrees.m_fValue;
446 return m_fValue != c_degrees.m_fValue;
461 << c_degrees.m_fValue
468 is >> c_degrees.m_fValue;
477 static const Real DEGREES_TO_RADIANS;
499 return CRadians(c_degrees.m_fValue * CDegrees::DEGREES_TO_RADIANS);
513 cResult.m_fValue =
Mod(c_angle1.m_fValue - c_angle2.m_fValue +
CRadians::PI.m_fValue,
531 cResult.m_fValue =
Mod(c_angle1.m_fValue - c_angle2.m_fValue + 180.0f, 360.0f);
532 if(cResult.m_fValue < 0.0f) cResult.m_fValue += 360.0f;
533 cResult.m_fValue -= 180.0f;
541 #ifdef ARGOS_USE_DOUBLE
543 # define ARGOS_SINCOS ::sincos
545 # define ARGOS_SINCOS ::__sincos
547 # define ARGOS_SIN ::sin
548 # define ARGOS_ASIN ::asin
549 # define ARGOS_COS ::cos
550 # define ARGOS_ACOS ::acos
551 # define ARGOS_TAN ::tan
552 # define ARGOS_ATAN2 ::atan2
555 # define ARGOS_SINCOS ::sincosf
557 # define ARGOS_SINCOS ::__sincosf
559 # define ARGOS_SIN ::sinf
560 # define ARGOS_ASIN ::asinf
561 # define ARGOS_COS ::cosf
562 # define ARGOS_ACOS ::acosf
563 # define ARGOS_TAN ::tanf
564 # define ARGOS_ATAN2 ::atan2f
CRadians operator-(const CRadians &c_radians) const
bool operator<=(const CRadians &c_radians) const
Real operator/(const CRadians &c_radians) const
Real Cos(const CRadians &c_radians)
Computes the cosine of the passed value in radians.
CRadians(Real f_value)
Class constructor It initializes m_fValue to the passed value.
The namespace containing all the ARGoS related code.
CDegrees & UnsignedNormalize()
Normalizes the value in the range [0:360].
friend CDegrees ToDegrees(const CRadians &c_radians)
Converts this object to CDegrees.
It defines the basic type CRadians, used to store an angle value in radians.
CDegrees operator/(Real f_value) const
void FromValueInRadians(Real f_value)
Sets the value from a value in radians It sets m_fValue (which is in degrees) converting from the pas...
static const CRadians PI_OVER_TWO
Set to PI / 2.
void SinCos(const CRadians &c_radians, Real &f_sin, Real &f_cos)
Computes the sine and cosine of the passed value in radians.
CDegrees ToDegrees(const CRadians &c_radians)
Converts CRadians to CDegrees.
friend std::istream & operator>>(std::istream &is, CRadians &c_radians)
Real GetAbsoluteValue() const
Returns the absolute value in degrees.
static const CRange< CRadians > SIGNED_RANGE
The signed normalization range [-PI:PI].
friend CRadians NormalizedDifference(const CRadians &c_rad1, const CRadians &c_rad2)
Calculates the normalized difference between the given angles.
bool operator>=(const CRadians &c_radians) const
CDegrees & operator*=(Real f_value)
CDegrees operator-(const CDegrees &c_degrees) const
CRadians & SignedNormalize()
Normalizes the value in the range [-PI:PI].
Real Sin(const CRadians &c_radians)
Computes the sine of the passed value in radians.
CRadians ATan2(const Real f_y, const Real f_x)
Computes the arctangent of the passed values.
bool operator!=(const CDegrees &c_degrees) const
friend CDegrees NormalizedDifference(const CDegrees &c_angle1, const CDegrees &c_angle2)
Calculates the normalized difference between the given angles.
CRadians()
Class constructor It initializes m_fValue to 0 radians.
CRadians ASin(Real f_value)
Computes the arcsine of the passed value.
CDegrees operator-() const
void FromValueInDegrees(Real f_value)
Sets the value from a value in degrees It sets m_fValue (which is in radians) converting from the pas...
friend std::ostream & operator<<(std::ostream &c_os, const CDegrees &c_degrees)
static const CRadians PI
The PI constant.
T Abs(const T &t_v)
Returns the absolute value of the passed argument.
Real GetValue() const
Returns the value in radians.
bool operator==(const CDegrees &c_degrees) const
CRadians operator*(Real f_value) const
bool operator>(const CDegrees &c_degrees) const
CRadians & operator*=(Real f_value)
CDegrees operator+(const CDegrees &c_degrees) const
static const CRadians PI_OVER_THREE
Set to PI / 3.
CDegrees()
Class constructor It initializes m_fValue to 0 degrees.
bool operator>(const CRadians &c_radians) const
CRadians & operator-=(const CRadians &c_radians)
friend CDegrees operator*(Real f_value, const CDegrees &c_degrees)
static const CRadians PI_OVER_FOUR
Set to PI / 4.
void SetValue(Real f_value)
Sets the value in degrees.
CDegrees operator*(Real f_value) const
static const CRadians PI_OVER_SIX
Set to PI / 6.
friend std::istream & operator>>(std::istream &is, CDegrees &c_degrees)
CDegrees(Real f_value)
Class constructor It initializes m_fValue to the passed value.
CDegrees & operator/=(Real f_value)
static const CRange< CRadians > UNSIGNED_RANGE
The unsigned normalization range [0:TWO_PI].
CRadians ACos(Real f_value)
Computes the arccosine of the passed value.
friend CRadians operator*(Real f_value, const CRadians &c_radians)
Real GetAbsoluteValue() const
Returns the absolute value in radians.
void SetValue(Real f_value)
Sets the value in radians.
CRadians operator-() const
bool operator>=(const CDegrees &c_degrees) const
CRadians & operator+=(const CRadians &c_radians)
bool operator==(const CRadians &c_radians) const
CDegrees & operator-=(const CDegrees &c_degrees)
Real GetValue() const
Returns the value in degrees.
friend CRadians ToRadians(const CDegrees &c_degrees)
Converts this object to CRadians.
Real operator/(const CDegrees &c_degrees) const
static const Real RADIANS_TO_DEGREES
Constant to convert from radians to degrees.
bool operator!=(const CRadians &c_radians) const
It defines the basic type CDegrees, used to store an angle value in degrees.
CDegrees & SignedNormalize()
Normalizes the value in the range [-180:180].
CRadians ToRadians(const CDegrees &c_degrees)
Converts CDegrees to CRadians.
bool operator<(const CRadians &c_radians) const
bool operator<=(const CDegrees &c_degrees) const
CRadians operator+(const CRadians &c_radians) const
Real Tan(const CRadians &c_radians)
Computes the tangent of the passed value in radians.
bool operator<(const CDegrees &c_degrees) const
static const CRadians TWO_PI
Set to PI * 2.
CDegrees & operator+=(const CDegrees &c_degrees)
float Real
Collects all ARGoS code.
CRadians NormalizedDifference(const CRadians &c_angle1, const CRadians &c_angle2)
Calculates the normalized difference between the given angles.
friend std::ostream & operator<<(std::ostream &c_os, const CRadians &c_radians)
CRadians & UnsignedNormalize()
Normalizes the value in the range [0:TWO_PI].
CRadians operator/(Real f_value) const
CRadians & operator/=(Real f_value)
static const CRadians ZERO
Set to zero radians.