new bbox features (2D, 3D)

added stair-sanitizing code
adjusted walkers
This commit is contained in:
2016-02-06 15:02:41 +01:00
parent 382a046df1
commit 5b35b5d3e0
4 changed files with 74 additions and 8 deletions

View File

@@ -49,6 +49,28 @@ public:
(p2.z == o.p2.z);
}
/** shrink the bbox in each dimension by the given amount */
void shrink(const float v) {
shrink(Point3(v,v,v));
}
/** shrink the bbox by the amount given for each dimension */
void shrink(const Point3& p) {
p1 += p; // increase minimum
p2 -= p; // decrease maximum
}
/** does the bbox contain the given point? */
bool contains(const Point3& p) const {
if (p.x < p1.x) {return false;}
if (p.x > p2.x) {return false;}
if (p.y < p1.y) {return false;}
if (p.y > p2.y) {return false;}
if (p.z < p1.z) {return false;}
if (p.z > p2.z) {return false;}
return true;
}
};
#endif // BBOX3_H