1 #ifndef __BASE_ANGLE_HH__ 2 #define __BASE_ANGLE_HH__ 6 #include <base/Float.hpp> 7 #include <base/Eigen.hpp> 37 explicit Angle(
double _rad ) : rad(_rad)
44 if( rad > M_PI || rad <= -M_PI )
47 const double side = copysign(M_PI,rad);
48 rad = -side + 2*M_PI * modf( (rad-side) / (2*M_PI), &intp );
58 static inline double rad2Deg(
double rad )
60 return rad / M_PI * 180.0;
68 static inline double deg2Rad(
double deg )
70 return deg / 180.0 * M_PI;
77 return Angle(rad).rad;
97 return Angle( deg / 180.0 * M_PI );
105 result.
rad = base::unknown<double>();
114 return Angle( nextafter(-M_PI, 0) );
138 return rad / M_PI * 180;
149 return fabs(
Angle(other.
rad - rad).getRad()) < prec;
159 return this->rad == other.
rad;
164 return this->rad < other.
rad;
169 return this->rad > other.
rad;
174 return this->rad <= other.
rad;
179 return this->rad >= other.
rad;
184 this->rad += other.
rad;
191 this->rad -= other.
rad;
221 return Angle(rad).flip();
274 bool isInside(
const Angle &angle)
const;
290 return std::vector<AngleSegment>();
298 std::vector<AngleSegment> getIntersections(
const AngleSegment &b)
const;
std::ostream & operator<<(std::ostream &os, Angle angle)
Definition: Angle.cpp:25
bool operator==(const Angle &other) const
Definition: Angle.hpp:157
void canonize()
Definition: Angle.hpp:42
Angle operator*(const Angle &other) const
Definition: Angle.hpp:206
std::vector< AngleSegment > split(const Angle &angle)
Definition: Angle.hpp:288
Angle & operator-=(const Angle &other)
Definition: Angle.hpp:189
Angle(double _rad)
Definition: Angle.hpp:37
Angle operator-(const Angle &other) const
Definition: Angle.hpp:201
static double normalizeRad(double rad)
Definition: Angle.hpp:75
double endRad
Definition: Angle.hpp:338
double getWidth() const
Definition: Angle.hpp:304
static Angle vectorToVector(const base::Vector3d &a, const base::Vector3d &b)
Definition: Angle.cpp:7
static Angle unknown()
Definition: Angle.hpp:102
static double deg2Rad(double deg)
Definition: Angle.hpp:68
Angle()
Definition: Angle.hpp:34
Definition: Angle.hpp:262
static Angle fromRad(double rad)
Definition: Angle.hpp:85
Angle flipped() const
Definition: Angle.hpp:219
static Angle Min()
Definition: Angle.hpp:112
bool operator<(const Angle &other) const
Definition: Angle.hpp:162
bool operator>=(const Angle &other) const
Definition: Angle.hpp:177
Angle operator*(const double &val) const
Definition: Angle.hpp:211
static double rad2Deg(double rad)
Definition: Angle.hpp:58
Definition: LinearAngular6DCommand.hpp:8
void operator=(const Angle &other)
Definition: Angle.hpp:152
double getRad() const
Definition: Angle.hpp:128
double rad
Definition: Angle.hpp:29
Angle & flip()
Definition: Angle.hpp:227
double startRad
Definition: Angle.hpp:333
bool split(const Angle &angle, AngleSegment &rest)
Definition: Angle.hpp:283
Eigen::Matrix< double, 3, 1, Eigen::DontAlign > Vector3d
Definition: Eigen.hpp:20
Angle operator+(const Angle &other) const
Definition: Angle.hpp:196
bool operator>(const Angle &other) const
Definition: Angle.hpp:167
Angle & operator+=(const Angle &other)
Definition: Angle.hpp:182
static Angle Max()
Definition: Angle.hpp:120
bool operator<=(const Angle &other) const
Definition: Angle.hpp:172
bool isApprox(Angle other, double prec=1e-5) const
Definition: Angle.hpp:147
double getDeg() const
Definition: Angle.hpp:136
static Angle fromDeg(double deg)
Definition: Angle.hpp:95
double width
Definition: Angle.hpp:328