added missing code changes

started working on refactoring of sensors
new test-cases
This commit is contained in:
2016-03-17 17:28:41 +01:00
parent 6346231a64
commit f8d7f768f1
18 changed files with 524 additions and 74 deletions

View File

@@ -60,6 +60,17 @@ public:
p2 -= p; // decrease maximum
}
/** grow the bbox by the amount given for each dimension */
void grow(const float v) {
grow(Point3(v,v,v));
}
/** grow the bbox by the amount given for each dimension */
void grow(const Point3& p) {
p1 -= p; // decrease minimum
p2 += p; // increase maximum
}
/** does the bbox contain the given point? */
bool contains(const Point3& p) const {
if (p.x < p1.x) {return false;}

View File

@@ -26,6 +26,8 @@ struct Point3 {
Point3 operator - (const Point3& o) const {return Point3(x-o.x, y-o.y, z-o.z);}
Point3 operator * (const Point3& o) const {return Point3(x*o.x, y*o.y, z*o.z);}
Point3 operator * (const float v) const {return Point3(v*x, v*y, v*z);}
Point3 operator / (const float v) const {return Point3(x/v, y/v, z/v);}
@@ -40,6 +42,8 @@ struct Point3 {
Point3& operator -= (const Point3& o) {x-=o.x; y-=o.y; z-=o.z; return *this;}
bool operator < (const Point3& o) const {return x<o.x && y<o.y && z<o.z;}
bool operator == (const Point3& o) const {return x==o.x && y==o.y && z==o.z;}
Point2 xy() const {return Point2(x,y);}