Go to the documentation of this file.
11 #ifndef BOUNDINGBOX_HPP
12 #define BOUNDINGBOX_HPP
26 typedef std::numeric_limits<T>
limits;
49 if(limits::is_integer)
67 for(
size_t i = 0; i < N; ++i)
74 operator bool()
const {
return not
empty(); }
79 return pts[0] == other.
pts[0] and
pts[1] == other.
pts[1];
99 for(
size_t i = 0; i < N; ++i) {
100 if(
pts[0][i] < other.
pts[0][i])
101 pts[0][i] = other.
pts[0][i];
102 if(
pts[1][i] > other.
pts[1][i])
103 pts[1][i] = other.
pts[1][i];
112 return copy &= other;
118 return (*
this) &= (other);
125 return copy &= other;
134 for(
size_t i = 0; i < N; ++i) {
135 if(
pts[0][i] > other.
pts[0][i])
136 pts[0][i] = other.
pts[0][i];
137 if(
pts[1][i] < other.
pts[1][i])
138 pts[1][i] = other.
pts[1][i];
147 return copy |= other;
153 return (*
this) |= (other);
160 return copy |= other;
169 for(
size_t i = 0; i < N; ++i) {
172 if(limits::is_integer) {
173 if(
pts[1][i] < p[i] + 1)
174 pts[1][i] = p[i] + 1;
219 return (p.
x() >=
pts[0].
x() and p.
y() >=
pts[0].
y() and p.
z() >=
pts[0].
z()
253 s << bbox.
pts[0] <<
" " << bbox.
pts[1];
260 s >> bbox.
pts[0] >> bbox.
pts[1];
267 s << bbox.
pts[0] <<
" " << bbox.
pts[1];
273 s >> bbox.
pts[0] >> bbox.
pts[1];
279 #endif // BOUNDINGBOX_HPP
CU_HOST_DEVICE BoundingBox operator*(const BoundingBox &other) const
CU_HOST_DEVICE friend std::ostream & operator<<(std::ostream &s, const BoundingBox &bbox)
CU_HOST_DEVICE bool operator==(const BoundingBox &other) const
CU_HOST_DEVICE BoundingBox operator|(const BoundingBox &other) const
CU_HOST_DEVICE Point * data()
CU_HOST_DEVICE bool empty() const
__device__ __host__ static T max()
friend QTextStream & operator>>(QTextStream &s, BoundingBox &bbox)
CU_HOST_DEVICE friend std::istream & operator>>(std::istream &s, BoundingBox &bbox)
CU_HOST_DEVICE void z(const T &v)
Short access to the third element.
CU_HOST_DEVICE Point & operator[](int i)
CU_HOST_DEVICE Point pmax() const
CU_HOST_DEVICE void reset()
CU_HOST_DEVICE BoundingBox operator|(const Point &p) const
const CU_HOST_DEVICE Point & operator[](int i) const
CU_HOST_DEVICE BoundingBox()
Distributed matrix library.
CU_HOST_DEVICE Point pmin()
CU_HOST_DEVICE BoundingBox operator+(const BoundingBox &other) const
CU_HOST_DEVICE BoundingBox(const BoundingBox ©)
CU_HOST_DEVICE BoundingBox & operator&=(const BoundingBox &other)
Bounding box intersection.
CU_HOST_DEVICE bool operator!=(const BoundingBox &other) const
CU_HOST_DEVICE BoundingBox operator&(const BoundingBox &other) const
CU_HOST_DEVICE bool contains(const Point &p) const
Check if a point is in the BoundingBox.
CU_HOST_DEVICE void y(const T &v)
Short access to the second element.
CU_HOST_DEVICE BoundingBox(const Point &p)
CU_HOST_DEVICE Point pmin() const
CU_HOST_DEVICE BoundingBox & operator*=(const BoundingBox &other)
CU_HOST_DEVICE BoundingBox & operator|=(const BoundingBox &other)
Bounding box union.
std::numeric_limits< T > limits
CU_HOST_DEVICE BoundingBox & operator|=(const Point &p)
Adding a point.
friend QTextStream & operator<<(QTextStream &s, const BoundingBox &bbox)
CU_HOST_DEVICE BoundingBox & operator+=(const BoundingBox &other)
CU_HOST_DEVICE Point size() const
CU_HOST_DEVICE Point pmax()
CU_HOST_DEVICE friend BoundingBox operator&(const Point &p, const BoundingBox &b)
CU_HOST_DEVICE void x(const T &v)
Short access to the first element.
CU_HOST_DEVICE BoundingBox(const Point &vmin, const Point &vmax)