This commit is contained in:
kazu
2016-05-24 17:02:26 +02:00
30 changed files with 610 additions and 62 deletions

View File

@@ -46,6 +46,11 @@ public:
return (Heading(*this) += _rad);
}
Heading& operator = (const float _rad) {
rad = _rad;
return *this;
}
/** compare two headings */
bool operator == (const Heading other) const {return rad == other.rad;}
bool operator != (const Heading other) const {return rad != other.rad;}
@@ -59,13 +64,13 @@ public:
float getRAD() const {return rad;}
/** get a random heading */
static Heading rnd() {
static std::minstd_rand gen(1234);
static std::uniform_real_distribution<float> dist(0, _2PI);
const float rnd = dist(gen);
return Heading(rnd);
}
// /** get a random heading */
// static Heading rnd() {
// static std::minstd_rand gen(1234);
// static std::uniform_real_distribution<float> dist(0, _2PI);
// const float rnd = dist(gen);
// return Heading(rnd);
// }
#undef _2PI