29 #ifndef vtkBoundingBox_h 30 #define vtkBoundingBox_h 43 double yMin,
double yMax,
44 double zMin,
double zMax);
62 void SetBounds(
const double bounds[6]);
63 void SetBounds(
double xMin,
double xMax,
64 double yMin,
double yMax,
65 double zMin,
double zMax);
71 void SetMinPoint(
double x,
double y,
double z);
72 void SetMinPoint(
double p[3]);
78 void SetMaxPoint(
double x,
double y,
double z);
79 void SetMaxPoint(
double p[3]);
85 void AddPoint(
double p[3]);
86 void AddPoint(
double px,
double py,
double pz);
94 void AddBounds(
const double bounds[]);
110 bool IntersectPlane(
double origin[3],
double normal[3]);
119 void GetBounds(
double bounds[6])
const;
120 void GetBounds(
double &xMin,
double &xMax,
121 double &yMin,
double &yMax,
122 double &zMin,
double &zMax)
const;
126 double GetBound(
int i)
const;
130 const double *GetMinPoint()
const;
131 void GetMinPoint(
double &x,
double &y,
double &z)
const;
136 const double *GetMaxPoint()
const;
137 void GetMaxPoint(
double &x,
double &y,
double &z)
const;
142 int ContainsPoint(
double p[3])
const;
143 int ContainsPoint(
double px,
double py,
double pz)
const;
147 void GetCenter(
double center[3])
const;
150 void GetLengths(
double lengths[3])
const;
153 double GetLength(
int i)
const;
156 double GetMaxLength()
const;
159 double GetDiagonalLength()
const;
163 void Inflate(
double delta);
169 static int IsValid(
const double bounds[6]);
180 void Scale(
double s[3]);
181 void Scale(
double sx,
187 double MinPnt[3], MaxPnt[3];
192 this->MinPnt[0] = this->MinPnt[1] = this->MinPnt[2] =
VTK_DOUBLE_MAX;
193 this->MaxPnt[0] = this->MaxPnt[1] = this->MaxPnt[2] =
VTK_DOUBLE_MIN;
197 double &yMin,
double &yMax,
198 double &zMin,
double &zMax)
const 200 xMin = this->MinPnt[0];
201 xMax = this->MaxPnt[0];
202 yMin = this->MinPnt[1];
203 yMax = this->MaxPnt[1];
204 zMin = this->MinPnt[2];
205 zMax = this->MaxPnt[2];
213 return ((i & 0x1) ? this->MaxPnt[i>>1] : this->MinPnt[i>>1]);
228 return ((this->MinPnt[0] <= this->MaxPnt[0]) &&
229 (this->MinPnt[1] <= this->MaxPnt[1]) &&
230 (this->MinPnt[2] <= this->MaxPnt[2]));
235 return (bounds[0] <= bounds[1] &&
236 bounds[2] <= bounds[3] &&
237 bounds[4] <= bounds[5]);
242 return this->MaxPnt[i] - this->MinPnt[i];
247 lengths[0] = this->GetLength(0);
248 lengths[1] = this->GetLength(1);
249 lengths[2] = this->GetLength(2);
254 center[0] = 0.5 * (this->MaxPnt[0] + this->MinPnt[0]);
255 center[1] = 0.5 * (this->MaxPnt[1] + this->MinPnt[1]);
256 center[2] = 0.5 * (this->MaxPnt[2] + this->MinPnt[2]);
261 this->SetBounds(bounds[0], bounds[1], bounds[2],
262 bounds[3], bounds[4], bounds[5]);
267 this->GetBounds(bounds[0], bounds[1], bounds[2],
268 bounds[3], bounds[4], bounds[5]);
279 this->SetBounds(bounds);
283 double yMin,
double yMax,
284 double zMin,
double zMax)
287 this->SetBounds(xMin, xMax, yMin, yMax, zMin, zMax);
292 this->MinPnt[0] = bbox.
MinPnt[0];
293 this->MinPnt[1] = bbox.
MinPnt[1];
294 this->MinPnt[2] = bbox.
MinPnt[2];
296 this->MaxPnt[0] = bbox.
MaxPnt[0];
297 this->MaxPnt[1] = bbox.
MaxPnt[1];
298 this->MaxPnt[2] = bbox.
MaxPnt[2];
303 this->MinPnt[0] = bbox.
MinPnt[0];
304 this->MinPnt[1] = bbox.
MinPnt[1];
305 this->MinPnt[2] = bbox.
MinPnt[2];
307 this->MaxPnt[0] = bbox.
MaxPnt[0];
308 this->MaxPnt[1] = bbox.
MaxPnt[1];
309 this->MaxPnt[2] = bbox.
MaxPnt[2];
315 return ((this->MinPnt[0] == bbox.
MinPnt[0]) &&
316 (this->MinPnt[1] == bbox.
MinPnt[1]) &&
317 (this->MinPnt[2] == bbox.
MinPnt[2]) &&
318 (this->MaxPnt[0] == bbox.
MaxPnt[0]) &&
319 (this->MaxPnt[1] == bbox.
MaxPnt[1]) &&
320 (this->MaxPnt[2] == bbox.
MaxPnt[2]));
325 return !((*this) == bbox);
330 this->SetMinPoint(p[0], p[1], p[2]);
335 this->SetMaxPoint(p[0], p[1], p[2]);
355 if ((px < this->MinPnt[0]) || (px > this->MaxPnt[0]))
359 if ((py < this->MinPnt[1]) || (py > this->MaxPnt[1]))
363 if ((pz < this->MinPnt[2]) || (pz > this->MaxPnt[2]))
372 return this->ContainsPoint(p[0], p[1], p[2]);
double GetBound(int i) const
void GetCenter(double center[3]) const
void SetMaxPoint(double x, double y, double z)
int operator==(const vtkBoundingBox &bbox) const
const double * GetMaxPoint() const
int operator!=(const vtkBoundingBox &bbox) const
int ContainsPoint(double p[3]) const
GLint GLint GLint GLint GLint GLint y
GLint GLint GLint GLint GLint x
vtkBoundingBox & operator=(const vtkBoundingBox &bbox)
GLsizei GLenum GLenum GLuint GLenum GLsizei * lengths
void SetMinPoint(double x, double y, double z)
const double * GetMinPoint() const
double GetLength(int i) const
void SetBounds(const double bounds[6])
void GetBounds(double bounds[6]) const
VTKCOMMONCORE_EXPORT bool operator!=(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
VTKCOMMONCORE_EXPORT bool operator==(const vtkUnicodeString &lhs, const vtkUnicodeString &rhs)
void GetLengths(double lengths[3]) const
#define VTKCOMMONDATAMODEL_EXPORT
Fast Simple Class for dealing with 3D bounds.