 |
VTK
9.0.1
|
Go to the documentation of this file.
27 #ifndef vtkBoundingBox_h
28 #define vtkBoundingBox_h
29 #include "vtkCommonDataModelModule.h"
44 vtkBoundingBox(
double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax);
70 void SetBounds(
const double bounds[6]);
71 void SetBounds(
double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax);
90 void SetMinPoint(
double p[3]);
99 void SetMaxPoint(
double p[3]);
108 static int IsValid(
const double bounds[6]);
161 void GetBounds(
double bounds[6])
const;
163 double& xMin,
double& xMax,
double& yMin,
double& yMax,
double& zMin,
double& zMax)
const;
169 double GetBound(
int i)
const;
176 void GetMinPoint(
double& x,
double& y,
double& z) const;
177 void GetMinPoint(
double x[3]) const;
185 void GetMaxPoint(
double& x,
double& y,
double& z) const;
186 void GetMaxPoint(
double x[3]) const;
193 void GetCorner(
int corner,
double p[3]) const;
200 vtkTypeBool ContainsPoint(
double px,
double py,
double pz) const;
206 void GetCenter(
double center[3]) const;
211 void GetLengths(
double lengths[3]) const;
216 double GetLength(
int i) const;
221 double GetMaxLength() const;
227 double GetDiagonalLength() const;
238 void Inflate(
double delta);
239 void Inflate(
double deltaX,
double deltaY,
double deltaZ);
250 void Scale(
double s[3]);
251 void Scale(
double sx,
double sy,
double sz);
260 void ScaleAboutCenter(
double s);
261 void ScaleAboutCenter(
double s[3]);
262 void ScaleAboutCenter(
double sx,
double sy,
double sz);
283 double MinPnt[3], MaxPnt[3];
288 this->MinPnt[0] = this->MinPnt[1] = this->MinPnt[2] =
VTK_DOUBLE_MAX;
289 this->MaxPnt[0] = this->MaxPnt[1] = this->MaxPnt[2] =
VTK_DOUBLE_MIN;
293 double& xMin,
double& xMax,
double& yMin,
double& yMax,
double& zMin,
double& zMax)
const
295 xMin = this->MinPnt[0];
296 xMax = this->MaxPnt[0];
297 yMin = this->MinPnt[1];
298 yMax = this->MaxPnt[1];
299 zMin = this->MinPnt[2];
300 zMax = this->MaxPnt[2];
308 return ((i & 0x1) ? this->MaxPnt[i >> 1] : this->MinPnt[i >> 1]);
318 x[0] = this->MinPnt[0];
319 x[1] = this->MinPnt[1];
320 x[2] = this->MinPnt[2];
330 x[0] = this->MaxPnt[0];
331 x[1] = this->MaxPnt[1];
332 x[2] = this->MaxPnt[2];
337 return ((this->MinPnt[0] <= this->MaxPnt[0]) && (this->MinPnt[1] <= this->MaxPnt[1]) &&
338 (this->MinPnt[2] <= this->MaxPnt[2]));
343 return (bounds[0] <= bounds[1] && bounds[2] <= bounds[3] && bounds[4] <= bounds[5]);
348 return this->MaxPnt[i] - this->MinPnt[i];
353 lengths[0] = this->GetLength(0);
354 lengths[1] = this->GetLength(1);
355 lengths[2] = this->GetLength(2);
360 center[0] = 0.5 * (this->MaxPnt[0] + this->MinPnt[0]);
361 center[1] = 0.5 * (this->MaxPnt[1] + this->MinPnt[1]);
362 center[2] = 0.5 * (this->MaxPnt[2] + this->MinPnt[2]);
367 this->SetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
372 this->GetBounds(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4], bounds[5]);
383 this->SetBounds(bounds);
387 double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax)
390 this->SetBounds(xMin, xMax, yMin, yMax, zMin, zMax);
395 this->MinPnt[0] = bbox.
MinPnt[0];
396 this->MinPnt[1] = bbox.
MinPnt[1];
397 this->MinPnt[2] = bbox.
MinPnt[2];
399 this->MaxPnt[0] = bbox.
MaxPnt[0];
400 this->MaxPnt[1] = bbox.
MaxPnt[1];
401 this->MaxPnt[2] = bbox.
MaxPnt[2];
406 this->MinPnt[0] = bbox.
MinPnt[0];
407 this->MinPnt[1] = bbox.
MinPnt[1];
408 this->MinPnt[2] = bbox.
MinPnt[2];
410 this->MaxPnt[0] = bbox.
MaxPnt[0];
411 this->MaxPnt[1] = bbox.
MaxPnt[1];
412 this->MaxPnt[2] = bbox.
MaxPnt[2];
418 return ((this->MinPnt[0] == bbox.
MinPnt[0]) && (this->MinPnt[1] == bbox.
MinPnt[1]) &&
419 (this->MinPnt[2] == bbox.
MinPnt[2]) && (this->MaxPnt[0] == bbox.
MaxPnt[0]) &&
420 (this->MaxPnt[1] == bbox.
MaxPnt[1]) && (this->MaxPnt[2] == bbox.
MaxPnt[2]));
425 return !((*this) == bbox);
430 this->SetMinPoint(p[0], p[1], p[2]);
435 this->SetMaxPoint(p[0], p[1], p[2]);
454 if ((px < this->MinPnt[0]) || (px > this->MaxPnt[0]))
458 if ((py < this->MinPnt[1]) || (py > this->MaxPnt[1]))
462 if ((pz < this->MinPnt[2]) || (pz > this->MaxPnt[2]))
471 return this->ContainsPoint(p[0], p[1], p[2]);
476 if ((corner < 0) || (corner > 7))
484 int ix = (corner & 1) ? 1 : 0;
485 int iy = ((corner >> 1) & 1) ? 1 : 0;
486 int iz = (corner >> 2) ? 1 : 0;
488 const double* pts[2] = { this->MinPnt, this->MaxPnt };
represent and manipulate 3D points
vtkBoundingBox & operator=(const vtkBoundingBox &bbox)
Assignment Operator.
const double * GetMaxPoint() const
Get the maximum point of the bounding box.
static void ComputeBounds(vtkPoints *pts, double bounds[6])
Compute the bounding box from an array of vtkPoints.
int IntersectBox(const vtkBoundingBox &bbox)
Intersect this box with bbox.
int IsValid() const
Returns 1 if the bounds have been set and 0 if the box is in its initialized state which is an invert...
void SetMinPoint(double x, double y, double z)
Set the minimum point of the bounding box - if the min point is greater than the max point then the m...
void GetLengths(double lengths[3]) const
Get the length of each sode of the box.
vtkTypeBool ContainsPoint(double p[3]) const
Returns 1 if the point is contained in the box else 0.
Fast, simple class for dealing with 3D bounds.
void SetMaxPoint(double x, double y, double z)
Set the maximum point of the bounding box - if the max point is less than the min point then the min ...
void SetBounds(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
#define VTK_SIZEHINT(...)
void AddBounds(const double bounds[])
Adjust the bounding box so it contains the specified bounds (defined by the VTK representation (xmin,...
void SetBounds(const double bounds[6])
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box).
void GetBounds(double bounds[6]) const
Get the bounds of the box (defined by VTK style).
bool operator!=(const vtkBoundingBox &bbox) const
static void ComputeBounds(vtkPoints *pts, const unsigned char *ptUses, double bounds[6])
const double * GetMinPoint() const
Get the minimum point of the bounding box.
bool operator==(const vtkBoundingBox &bbox) const
Equality operator.
void GetCenter(double center[3]) const
Get the center of the bounding box.
int Contains(const vtkBoundingBox &bbox) const
Returns 1 if the min and max points of bbox are contained within the bounds of the specified box,...
double GetLength(int i) const
Return the length of the bounding box in the ith direction.
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
void AddPoint(double p[3])
Change bounding box so it includes the point p.
void AddPoint(double px, double py, double pz)
vtkBoundingBox()
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE...
void GetCorner(int corner, double p[3]) const
Get the ith corner of the bounding box.
int Intersects(const vtkBoundingBox &bbox) const
Returns 1 if the boxes intersect else returns 0.
bool IntersectPlane(double origin[3], double normal[3])
Intersect this box with the half space defined by plane.
VTKCOMMONCORE_EXPORT bool operator!=(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
double GetBound(int i) const
Return the ith bounds of the box (defined by VTK style).
void AddBox(const vtkBoundingBox &bbox)
Change the bounding box to be the union of itself and the specified bbox.