13 assert(numAngles >= 0);
16 int num = (theta / -numAngles) + 1;
17 theta += numAngles * num;
20 if(theta >= numAngles)
21 theta = theta % numAngles;
25 DiscreteTheta(
int val,
unsigned int numAngles) : theta(val) , numAngles(numAngles) {
29 DiscreteTheta(
double val,
unsigned int numAngles) : numAngles(numAngles) {
30 theta = round((val * numAngles) / (2.0 * M_PI));
65 return l.theta < r.theta;
70 return l.theta == r.theta;
80 return M_PI * 2.0 * theta /
static_cast<double>(numAngles);
93 int b = numAngles - diffA.theta;
std::ostream & operator<<(std::ostream &stream, const DiscreteTheta &angle)
Definition: DiscreteTheta.cpp:3
Definition: DiscreteTheta.hpp:7
DiscreteTheta(const DiscreteTheta &o)
Definition: DiscreteTheta.hpp:34
double getRadian() const
Definition: DiscreteTheta.hpp:78
friend bool operator==(const DiscreteTheta &l, const DiscreteTheta &r)
Definition: DiscreteTheta.hpp:68
int getNumAngles() const
Definition: DiscreteTheta.hpp:83
DiscreteTheta(double val, unsigned int numAngles)
Definition: DiscreteTheta.hpp:29
DiscreteTheta & operator+=(const DiscreteTheta &rhs)
Definition: DiscreteTheta.hpp:37
friend DiscreteTheta operator+(DiscreteTheta lhs, const DiscreteTheta &rhs)
Definition: DiscreteTheta.hpp:51
DiscreteTheta & operator-=(const DiscreteTheta &rhs)
Definition: DiscreteTheta.hpp:44
DiscreteTheta(int val, unsigned int numAngles)
Definition: DiscreteTheta.hpp:25
friend DiscreteTheta operator-(DiscreteTheta lhs, const DiscreteTheta &rhs)
Definition: DiscreteTheta.hpp:57
int getTheta() const
Definition: DiscreteTheta.hpp:73
DiscreteTheta shortestDist(const DiscreteTheta &ain) const
Definition: DiscreteTheta.hpp:88
friend bool operator<(const DiscreteTheta &l, const DiscreteTheta &r)
Definition: DiscreteTheta.hpp:63