New constructors for the bounding box with min/max points were added.
empty(bbox) function template was added.
This commit is contained in:
parent
33ddb13e5d
commit
c8ff517389
@ -21,6 +21,7 @@ class BoundingBoxBase
|
||||
bool defined;
|
||||
|
||||
BoundingBoxBase() : defined(false) {};
|
||||
BoundingBoxBase(const PointClass &pmin, const PointClass &pmax) : min(pmin), max(pmax) {}
|
||||
BoundingBoxBase(const std::vector<PointClass> &points);
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
@ -37,6 +38,7 @@ class BoundingBox3Base : public BoundingBoxBase<PointClass>
|
||||
{
|
||||
public:
|
||||
BoundingBox3Base() : BoundingBoxBase<PointClass>() {};
|
||||
BoundingBox3Base(const PointClass &pmin, const PointClass &pmax) : BoundingBoxBase<PointClass>(pmin, pmax) {}
|
||||
BoundingBox3Base(const std::vector<PointClass> &points);
|
||||
void merge(const PointClass &point);
|
||||
void merge(const std::vector<PointClass> &points);
|
||||
@ -54,6 +56,7 @@ class BoundingBox : public BoundingBoxBase<Point>
|
||||
Polygon polygon() const;
|
||||
|
||||
BoundingBox() : BoundingBoxBase<Point>() {};
|
||||
BoundingBox(const Point &pmin, const Point &pmax) : BoundingBoxBase<Point>(pmin, pmax) {};
|
||||
BoundingBox(const Points &points) : BoundingBoxBase<Point>(points) {};
|
||||
BoundingBox(const Lines &lines);
|
||||
};
|
||||
@ -65,15 +68,39 @@ class BoundingBox3 : public BoundingBox3Base<Point3> {};
|
||||
class BoundingBoxf : public BoundingBoxBase<Pointf> {
|
||||
public:
|
||||
BoundingBoxf() : BoundingBoxBase<Pointf>() {};
|
||||
BoundingBoxf(const Pointf &pmin, const Pointf &pmax) : BoundingBoxBase<Pointf>(pmin, pmax) {};
|
||||
BoundingBoxf(const std::vector<Pointf> &points) : BoundingBoxBase<Pointf>(points) {};
|
||||
};
|
||||
|
||||
class BoundingBoxf3 : public BoundingBox3Base<Pointf3> {
|
||||
public:
|
||||
BoundingBoxf3() : BoundingBox3Base<Pointf3>() {};
|
||||
BoundingBoxf3(const Pointf3 &pmin, const Pointf3 &pmax) : BoundingBox3Base<Pointf3>(pmin, pmax) {};
|
||||
BoundingBoxf3(const std::vector<Pointf3> &points) : BoundingBox3Base<Pointf3>(points) {};
|
||||
};
|
||||
|
||||
template<typename VT>
|
||||
inline bool operator==(const BoundingBoxBase<VT> &bb1, const BoundingBoxBase<VT> &bb2)
|
||||
{
|
||||
return bb1.min == bb2.min && bb1.max == bb2.max;
|
||||
}
|
||||
|
||||
template<typename VT>
|
||||
inline bool operator!=(const BoundingBoxBase<VT> &bb1, const BoundingBoxBase<VT> &bb2)
|
||||
{
|
||||
return !(bb1 == bb2);
|
||||
}
|
||||
|
||||
template<typename VT>
|
||||
inline bool empty(const BoundingBoxBase<VT> &bb)
|
||||
{
|
||||
return bb.min.x > bb.max.y || bb.min.y > bb.max.y;
|
||||
}
|
||||
|
||||
template<typename VT>
|
||||
inline bool empty(const BoundingBox3Base<VT> &bb)
|
||||
{
|
||||
return bb.min.x > bb.max.x || bb.min.y > bb.max.y || bb.min.z > bb.max.z;}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user