huge commit

- worked on about everything
- grid walker using plugable modules
- wifi models
- new distributions
- worked on geometric data-structures
- added typesafe timestamps
- worked on grid-building
- added sensor-classes
- added sensor analysis (step-detection, turn-detection)
- offline data reader
- many test-cases
This commit is contained in:
2016-08-29 08:18:44 +02:00
parent 99ee95ce7b
commit a2c9e575a2
94 changed files with 8298 additions and 257 deletions

View File

@@ -40,6 +40,18 @@ public:
return (tmp <= M_PI) ? (tmp) : (2*M_PI-tmp);
}
/**
* gets the angular difference between
* - the given radians [0:2PI]
* - as a change-in-direction between [-PI:+PI]
*/
static float getSignedDiffRAD_2PI(const float r1, const float r2) {
Assert::isBetween(r1, 0.0f, (float)(2*M_PI), "r1 out of bounds");
Assert::isBetween(r2, 0.0f, (float)(2*M_PI), "r2 out of bounds");
const float a1 = (r2-r1);
if (std::abs(a1) < M_PI) {return a1;} else {return (M_PI-a1);}
}
/** convert degrees to radians */
static constexpr float degToRad(const float deg) {
return deg / 180.0f * M_PI;

View File

@@ -37,6 +37,12 @@ public:
}
/** add the given bounding-box to this one */
void add(const BBox3& bb) {
add(bb.getMin());
add(bb.getMax());
}
/** get the bbox's minimum */
const Point3& getMin() const {return p1;}

View File

@@ -27,25 +27,53 @@ public:
Assert::isBetween(rad, 0.0f, (float)_2PI, "radians out of bounds");
}
/** angular difference [0:PI] */
/** POSITIVE angular difference [0:PI] */
float getDiffHalfRAD(const Heading other) const {
return Angle::getDiffRAD_2PI_PI(rad, other.rad);
}
/** signled angular difference [-PI:+PI] */
float getSignedDiff(const Heading other) const {
return Angle::getSignedDiffRAD_2PI(rad, other.rad);
}
/** update the angle but ensure we stay within [0:2PI] */
Heading& operator += (const float _rad) {
Assert::isBetween(_rad, float(-_2PI*0.99), float(+_2PI*0.99), "radians out of bounds");
// Assert::isBetween(_rad, float(-_2PI*0.999), float(+_2PI*0.999), "radians out of bounds");
// Assert::isBetween(_rad, float(-_2PI), float(+_2PI), "radians out of bounds");
rad += _rad;
if (rad >= _2PI) {rad -= _2PI;}
else if (rad < 0) {rad += _2PI;}
while (rad >= _2PI) {rad -= _2PI;}
while (rad < 0) {rad += _2PI;}
return *this;
}
/** update the angle but ensure we stay within [0:2PI] */
Heading& operator -= (const float _rad) {
return *this += (-_rad);
}
/** update the angle but ensure we stay within [0:2PI] */
Heading operator + (const float _rad) const {
return (Heading(*this) += _rad);
}
/** update the angle but ensure we stay within [0:2PI] */
Heading operator - (const float _rad) const {
return (Heading(*this) -= _rad);
}
/** update the angle but ensure we stay within [0:2PI] */
Heading operator - (const Heading head) const {
return *this - head.rad;
}
/** update the angle but ensure we stay within [0:2PI] */
Heading operator + (const Heading head) const {
return *this + head.rad;
}
Heading& operator = (const float _rad) {
rad = _rad;
return *this;

View File

@@ -47,6 +47,10 @@ struct Point2 {
Point2 normalized() const {return (*this) / length();}
Point2 rotated(const float rad) const {
return Point2(x*std::cos(rad)-y*std::sin(rad), x*std::sin(rad)+y*std::cos(rad));
}
/** get the distance between this point and the other one */
float getDistance(const Point2& o) const {
const float dx = x - o.x;

View File

@@ -92,6 +92,9 @@ struct Point3 {
return std::sqrt(dx*dx + dy*dy + dz*dz);
}
/** get a normalized copy */
Point3 normalized() const {return *this / this->length();}
float length() const {return std::sqrt(x*x + y*y + z*z);}
float length(const float norm) const {
@@ -109,4 +112,16 @@ private:
};
inline bool dot(const Point3& p1, const Point3& p2) {
return p1.x*p2.x + p1.y*p2.y + p1.z*p2.z;
}
inline Point3 cross(const Point3& a, const Point3& b) {
return Point3(
a.y*b.z - a.z*b.y,
a.z*b.x - a.x*b.z,
a.x*b.y - a.y*b.x
);
}
#endif // POINT3_H