17 #ifndef IGNITION_MATH_ANGLE_HH_ 18 #define IGNITION_MATH_ANGLE_HH_ 22 #include <ignition/math/config.hh> 28 #define IGN_RTOD(r) ((r) * 180 / IGN_PI) 34 #define IGN_DTOR(d) ((d) * IGN_PI / 180) 40 #define IGN_NORMALIZE(a) (atan2(sin(a), cos(a))) 47 inline namespace IGNITION_MATH_VERSION_NAMESPACE {
51 class IGNITION_MATH_VISIBLE
Angle 71 public:
Angle(
const double _radian);
78 public:
virtual ~
Angle();
82 public:
void Radian(
double _radian);
86 public:
void Degree(
double _degree);
90 public:
double Radian()
const;
94 public:
double Degree()
const;
97 public:
void Normalize();
101 public:
double operator()()
const;
113 public:
Angle operator-(
const Angle &_angle)
const;
118 public:
Angle operator+(
const Angle &_angle)
const;
123 public:
Angle operator*(
const Angle &_angle)
const;
128 public:
Angle operator/(
const Angle &_angle)
const;
133 public:
Angle operator-=(
const Angle &_angle);
138 public:
Angle operator+=(
const Angle &_angle);
143 public:
Angle operator*=(
const Angle &_angle);
148 public:
Angle operator/=(
const Angle &_angle);
153 public:
bool operator==(
const Angle &_angle)
const;
158 public:
bool operator!=(
const Angle &_angle)
const;
163 public:
bool operator<(
const Angle &_angle)
const;
168 public:
bool operator<=(
const Angle &_angle)
const;
173 public:
bool operator>(
const Angle &_angle)
const;
178 public:
bool operator>=(
const Angle &_angle)
const;
199 _in.
setf(std::ios_base::skipws);
205 private:
double value;
An angle and related functions.
Definition: Angle.hh:51
static const Angle Pi
math::Angle(IGN_PI)
Definition: Angle.hh:57
static const Angle HalfPi
math::Angle(IGN_PI * 0.5)
Definition: Angle.hh:60
void Radian(double _radian)
Set the value from an angle in radians.
static const Angle TwoPi
math::Angle(IGN_PI * 2)
Definition: Angle.hh:63
friend std::ostream & operator<<(std::ostream &_out, const Angle &_a)
Stream insertion operator. Outputs in degrees.
Definition: Angle.hh:184
friend std::istream & operator>>(std::istream &_in, Angle &_a)
Stream extraction operator. Assumes input is in radians.
Definition: Angle.hh:195
static const Angle Zero
math::Angle(0)
Definition: Angle.hh:54
double operator*() const
Dereference operator.
Definition: Angle.hh:105