64 for (
unsigned i = 0; i < a.size(); ++i)
66 bl[i] = std::min(a[i], b[i]);
67 tr[i] = std::max(a[i], b[i]);
70 elems[0] =
static_cast<int> (bl[0]);
71 elems[1] =
static_cast<int> (tr[0]);
72 elems[2] =
static_cast<int> (bl[1]);
73 elems[3] =
static_cast<int> (tr[1]);
74 elems[4] =
static_cast<int> (bl[2]);
75 elems[5] =
static_cast<int> (tr[2]);
80 Eigen::Vector3i bl, tr;
81 for (
unsigned i = 0; i < a.size(); ++i)
83 bl[i] = std::min(a[i], b[i]);
84 tr[i] = std::max(a[i], b[i]);
87 elems[0] =
static_cast<int> (bl[0]);
88 elems[1] =
static_cast<int> (tr[0]);
89 elems[2] =
static_cast<int> (bl[1]);
90 elems[3] =
static_cast<int> (tr[1]);
91 elems[4] =
static_cast<int> (bl[2]);
92 elems[5] =
static_cast<int> (tr[2]);
97 for (
unsigned i = 0; i < size(); ++i)
98 elems[i] = static_cast<int> (data[i]);
103 std::copy(data, data + size(), elems);
108 return Eigen::Vector3i(elems[0], elems[2], elems[4]);
112 return Eigen::Vector3i(elems[1], elems[3], elems[5]);
129 c[0] = x ? elems[1] : elems[0];
130 c[1] = y ? elems[3] : elems[2];
131 c[2] = z ? elems[5] : elems[4];
141 for (
unsigned i = 0; i < 3; ++i)
142 inside &= ((elems[2 * i] <= p[i]) && (p[i] <= elems[2 * i + 1]));
171 for (
unsigned i = 0; i < a.size(); ++i)
173 bl[i] = std::min(a[i], b[i]);
174 tr[i] = std::max(a[i], b[i]);
186 std::copy(data, data + size(), elems);
190 std::copy(data, data + size(), elems);
194 for (
unsigned i = 0; i < size(); ++i)
196 elems[i] = bb.elems[i];
211 return Vector3D(elems[0], elems[2], elems[4]);
215 return Vector3D(elems[1], elems[3], elems[5]);
232 c[0] = x ? elems[1] : elems[0];
233 c[1] = y ? elems[3] : elems[2];
234 c[2] = z ? elems[5] : elems[4];
244 for (
unsigned i = 0; i < 3; ++i)
245 inside &= ((elems[2 * i] <= p[i]) && (p[i] <= elems[2 * i + 1]));
268 for (
unsigned int i = 0; i < cloud.size(); ++i)
270 for (
unsigned int j = 0; j < 3; ++j)
272 a[j] = std::min(a[j], cloud[i][j]);
273 b[j] = std::max(b[j], cloud[i][j]);
289 std::vector<Vector3D> cloud;
290 cloud.push_back(
corner(0,0,0));
291 cloud.push_back(other.
corner(0,0,0));
292 cloud.push_back(
corner(0,0,1));
293 cloud.push_back(other.
corner(0,0,1));
294 cloud.push_back(
corner(0,1,0));
295 cloud.push_back(other.
corner(0,1,0));
296 cloud.push_back(
corner(0,1,1));
297 cloud.push_back(other.
corner(0,1,1));
298 cloud.push_back(
corner(1,0,0));
299 cloud.push_back(other.
corner(1,0,0));
300 cloud.push_back(
corner(1,0,1));
301 cloud.push_back(other.
corner(1,0,1));
302 cloud.push_back(
corner(1,1,0));
303 cloud.push_back(other.
corner(1,1,0));
304 cloud.push_back(
corner(1,1,1));
305 cloud.push_back(other.
corner(1,1,1));
DoubleBoundingBox3D unionWith(const DoubleBoundingBox3D &other) const
Vector3D topRight() const
Vector3D corner(int x, int y, int z) const
static DoubleBoundingBox3D fromViewport(const double *data)
Vector3D bottomLeft() const
static DoubleBoundingBox3D fromString(const QString &text)
construct a bb from a string containing 6 whitespace-separated numbers
std::ostream & stream_range(std::ostream &s, ITER begin, ITER end, char separator=' ')
static DoubleBoundingBox3D fromCloud(std::vector< Vector3D > cloud)
bool similar(const DoubleBoundingBox3D &a, const DoubleBoundingBox3D &b, double tol)
Eigen::Vector3i topRight() const
Eigen::Vector3i bottomLeft() const
Eigen::Vector3i range() const
Representation of an integer bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
Representation of a floating-point bounding box in 3D. The data are stored as {xmin,xmax,ymin,ymax,zmin,zmax}, in order to simplify communication with vtk.
std::ostream & operator<<(std::ostream &s, const IntBoundingBox3D &data)
bool contains(const Eigen::Vector3i &p) const
Eigen::Vector3d Vector3D
Vector3D is a representation of a point or vector in 3D.
Eigen::Vector3i corner(int x, int y, int z) const
Eigen::Vector3i center() const
std::vector< double > convertQString2DoubleVector(const QString &input, bool *ok)
bool contains(const Vector3D &p) const