Out of bed detection - 1st installment

This commit is contained in:
Enrico Turri 2018-03-09 10:40:42 +01:00
parent 83a2d2af4b
commit bdd2d725c8
15 changed files with 689 additions and 188 deletions

View file

@ -94,6 +94,38 @@ public:
void translate(const Pointf3 &pos) { this->translate(pos.x, pos.y, pos.z); }
void offset(coordf_t delta);
PointClass center() const;
bool contains(const PointClass &point) const {
return BoundingBoxBase<PointClass>::contains(point) && point.z >= this->min.z && point.z <= this->max.z;
}
bool contains(const BoundingBox3Base<PointClass>& other) const {
if (!contains(other.min))
return false;
if (!contains(PointClass(other.max.x, other.min.y, other.min.z)))
return false;
if (!contains(PointClass(other.max.x, other.max.y, other.min.z)))
return false;
if (!contains(PointClass(other.min.x, other.max.y, other.min.z)))
return false;
if (!contains(PointClass(other.min.x, other.min.y, other.max.z)))
return false;
if (!contains(PointClass(other.max.x, other.min.y, other.max.z)))
return false;
if (!contains(other.max))
return false;
if (!contains(PointClass(other.min.x, other.max.y, other.max.z)))
return false;
return true;
}
};
class BoundingBox : public BoundingBoxBase<Point>