added new helper methods
worked on gridWalker v3
This commit is contained in:
@@ -77,10 +77,10 @@ public:
|
||||
}
|
||||
|
||||
|
||||
Heading& operator = (const float _rad) {
|
||||
rad = _rad;
|
||||
return *this;
|
||||
}
|
||||
Heading& operator = (const float _rad) {
|
||||
rad = _rad;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/** compare two headings */
|
||||
bool operator == (const Heading other) const {return rad == other.rad;}
|
||||
@@ -95,6 +95,11 @@ public:
|
||||
|
||||
float getRAD() const {return rad;}
|
||||
|
||||
/** convert heading into a direction-vector */
|
||||
Point2 asVector() const {
|
||||
return Point2(std::cos(rad), std::sin(rad));
|
||||
}
|
||||
|
||||
// /** get a random heading */
|
||||
// static Heading rnd() {
|
||||
// static std::minstd_rand gen(1234);
|
||||
|
||||
Reference in New Issue
Block a user