new bbox features (2D, 3D)
added stair-sanitizing code adjusted walkers
This commit is contained in:
22
geo/BBox3.h
22
geo/BBox3.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user