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 {
61 class IGNITION_MATH_VISIBLE
Angle 93 public:
Angle(
const double _radian);
101 public:
virtual ~
Angle();
106 public:
void Radian(
double _radian);
110 public:
void SetRadian(
double _radian);
115 public:
void Degree(
double _degree);
119 public:
void SetDegree(
double _degree);
123 public:
double Radian()
const;
127 public:
double Degree()
const;
132 public:
void Normalize();
137 public:
Angle Normalized()
const;
141 public:
double operator()()
const;
153 public:
Angle operator-(
const Angle &_angle)
const;
158 public:
Angle operator+(
const Angle &_angle)
const;
163 public:
Angle operator*(
const Angle &_angle)
const;
168 public:
Angle operator/(
const Angle &_angle)
const;
173 public:
Angle operator-=(
const Angle &_angle);
178 public:
Angle operator+=(
const Angle &_angle);
183 public:
Angle operator*=(
const Angle &_angle);
188 public:
Angle operator/=(
const Angle &_angle);
193 public:
bool operator==(
const Angle &_angle)
const;
198 public:
bool operator!=(
const Angle &_angle)
const;
203 public:
bool operator<(
const Angle &_angle)
const;
208 public:
bool operator<=(
const Angle &_angle)
const;
213 public:
bool operator>(
const Angle &_angle)
const;
218 public:
bool operator>=(
const Angle &_angle)
const;
239 _in.
setf(std::ios_base::skipws);
245 private:
double value{0};
The Angle class is used to simplify and clarify the use of radians and degrees measurements. A default constructed Angle instance has a value of zero radians/degrees.
Definition: Angle.hh:61
static const Angle Pi
An angle with a value of Pi. Equivalent to math::Angle(IGN_PI).
Definition: Angle.hh:69
static const Angle HalfPi
An angle with a value of Pi * 0.5. Equivalent to math::Angle(IGN_PI * 0.5).
Definition: Angle.hh:73
void Radian(double _radian)
Set the value from an angle in radians.
static const Angle TwoPi
An angle with a value of Pi * 2. Equivalent to math::Angle(IGN_PI * 2).
Definition: Angle.hh:77
friend std::ostream & operator<<(std::ostream &_out, const Angle &_a)
Stream insertion operator. Outputs in radians.
Definition: Angle.hh:224
friend std::istream & operator>>(std::istream &_in, Angle &_a)
Stream extraction operator. Assumes input is in radians.
Definition: Angle.hh:235
static const Angle Zero
An angle with a value of zero. Equivalent to math::Angle(0).
Definition: Angle.hh:65
double operator*() const
Dereference operator.
Definition: Angle.hh:145