VTK
|
Fast Simple Class for dealing with 3D bounds. More...
#include <vtkBoundingBox.h>
Public Member Functions | |
vtkBoundingBox (const vtkBoundingBox &bbox) | |
Copy constructor. More... | |
vtkBoundingBox & | operator= (const vtkBoundingBox &bbox) |
Assignment Operator. More... | |
void | AddBox (const vtkBoundingBox &bbox) |
Change the bounding box to be the union of itself and the specified bbox. More... | |
void | AddBounds (const double bounds[]) |
Adjust the bounding box so it contains the specified bounds (defined by the VTK representation (xmin,xmax, ymin,ymax, zmin,zmax). More... | |
int | IntersectBox (const vtkBoundingBox &bbox) |
Intersect this box with bbox. More... | |
int | Intersects (const vtkBoundingBox &bbox) const |
Returns 1 if the boxes intersect else returns 0. More... | |
bool | IntersectPlane (double origin[3], double normal[3]) |
Intersect this box with the half space defined by plane. More... | |
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, else returns 0. More... | |
double | GetBound (int i) const |
Return the ith bounds of the box (defined by VTK style). More... | |
void | GetCorner (int corner, double p[3]) const |
Get the ith corner of the bounding box. More... | |
void | GetCenter (double center[3]) const |
Get the center of the bounding box. More... | |
void | GetLengths (double lengths[3]) const |
Get the length of each sode of the box. More... | |
double | GetLength (int i) const |
Return the length of the bounding box in the ith direction. More... | |
double | GetMaxLength () const |
Return the maximum length of the box. More... | |
double | GetDiagonalLength () const |
Return the length of the diagonal. More... | |
vtkIdType | ComputeDivisions (vtkIdType totalBins, double bounds[6], int divs[3]) const |
Compute the number of divisions in the z-y-z directions given a target number of total bins (i.e., product of divisions in the x-y-z directions). More... | |
void | Reset () |
Returns the box to its initialized state. More... | |
vtkBoundingBox () | |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN. More... | |
vtkBoundingBox (const double bounds[6]) | |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN. More... | |
vtkBoundingBox (double xMin, double xMax, double yMin, double yMax, double zMin, double zMax) | |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN. More... | |
bool | operator== (const vtkBoundingBox &bbox) const |
Equality operator. More... | |
bool | operator!= (const vtkBoundingBox &bbox) const |
Equality operator. More... | |
void | SetBounds (const double bounds[6]) |
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box). More... | |
void | SetBounds (double xMin, double xMax, double yMin, double yMax, double zMin, double zMax) |
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box). More... | |
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 max point will also be changed. More... | |
void | SetMinPoint (double p[3]) |
Set the minimum point of the bounding box - if the min point is greater than the max point then the max point will also be changed. More... | |
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 point will also be changed. More... | |
void | SetMaxPoint (double p[3]) |
Set the maximum point of the bounding box - if the max point is less than the min point then the min point will also be changed. More... | |
void | AddPoint (double p[3]) |
Change bounding box so it includes the point p. More... | |
void | AddPoint (double px, double py, double pz) |
Change bounding box so it includes the point p. More... | |
void | GetBounds (double bounds[6]) const |
Get the bounds of the box (defined by VTK style). More... | |
void | GetBounds (double &xMin, double &xMax, double &yMin, double &yMax, double &zMin, double &zMax) const |
Get the bounds of the box (defined by VTK style). More... | |
const double * | GetMinPoint () const |
Get the minimum point of the bounding box. More... | |
void | GetMinPoint (double &x, double &y, double &z) const |
Get the minimum point of the bounding box. More... | |
void | GetMinPoint (double x[3]) |
Get the minimum point of the bounding box. More... | |
const double * | GetMaxPoint () const |
Get the maximum point of the bounding box. More... | |
void | GetMaxPoint (double &x, double &y, double &z) const |
Get the maximum point of the bounding box. More... | |
void | GetMaxPoint (double x[3]) |
Get the maximum point of the bounding box. More... | |
vtkTypeBool | ContainsPoint (double p[3]) const |
Returns 1 if the point is contained in the box else 0. More... | |
vtkTypeBool | ContainsPoint (double px, double py, double pz) const |
Returns 1 if the point is contained in the box else 0. More... | |
void | Inflate (double delta) |
Expand the bounding box. More... | |
void | Inflate (double deltaX, double deltaY, double deltaZ) |
Expand the bounding box. More... | |
void | Inflate () |
Expand the bounding box. More... | |
void | Scale (double s[3]) |
Scale each dimension of the box by some given factor. More... | |
void | Scale (double sx, double sy, double sz) |
Scale each dimension of the box by some given factor. More... | |
void | ScaleAboutCenter (double s) |
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling. More... | |
void | ScaleAboutCenter (double s[3]) |
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling. More... | |
void | ScaleAboutCenter (double sx, double sy, double sz) |
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling. More... | |
Protected Attributes | |
double | MinPnt [3] |
double | MaxPnt [3] |
int | IsValid () const |
Returns 1 if the bounds have been set and 0 if the box is in its initialized state which is an inverted state. More... | |
static int | IsValid (const double bounds[6]) |
Returns 1 if the bounds have been set and 0 if the box is in its initialized state which is an inverted state. More... | |
Fast Simple Class for dealing with 3D bounds.
vtkBoundingBox maintains a 3D axis aligned bounding box. It is very light weight and many of the member functions are in-lined so it is very fast. It is not derived from vtkObject so it can be allocated on the stack
Definition at line 35 of file vtkBoundingBox.h.
|
inline |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN.
Definition at line 377 of file vtkBoundingBox.h.
|
inline |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN.
Definition at line 382 of file vtkBoundingBox.h.
|
inline |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN.
Definition at line 388 of file vtkBoundingBox.h.
|
inline |
Copy constructor.
Definition at line 396 of file vtkBoundingBox.h.
|
inline |
Assignment Operator.
Definition at line 407 of file vtkBoundingBox.h.
|
inline |
Equality operator.
Definition at line 419 of file vtkBoundingBox.h.
|
inline |
Equality operator.
Definition at line 429 of file vtkBoundingBox.h.
|
inline |
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box).
Returns 1 if the box was changed else 0.
Definition at line 365 of file vtkBoundingBox.h.
void vtkBoundingBox::SetBounds | ( | double | xMin, |
double | xMax, | ||
double | yMin, | ||
double | yMax, | ||
double | zMin, | ||
double | zMax | ||
) |
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box).
Returns 1 if the box was changed else 0.
Set the minimum point of the bounding box - if the min point is greater than the max point then the max point will also be changed.
|
inline |
Set the minimum point of the bounding box - if the min point is greater than the max point then the max point will also be changed.
Definition at line 434 of file vtkBoundingBox.h.
Set the maximum point of the bounding box - if the max point is less than the min point then the min point will also be changed.
|
inline |
Set the maximum point of the bounding box - if the max point is less than the min point then the min point will also be changed.
Definition at line 439 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the bounds have been set and 0 if the box is in its initialized state which is an inverted state.
Definition at line 332 of file vtkBoundingBox.h.
Returns 1 if the bounds have been set and 0 if the box is in its initialized state which is an inverted state.
Definition at line 339 of file vtkBoundingBox.h.
void vtkBoundingBox::AddPoint | ( | double | p[3] | ) |
Change bounding box so it includes the point p.
Note that the bounding box may have 0 volume if its bounds were just initialized.
Change bounding box so it includes the point p.
Note that the bounding box may have 0 volume if its bounds were just initialized.
void vtkBoundingBox::AddBox | ( | const vtkBoundingBox & | bbox | ) |
Change the bounding box to be the union of itself and the specified bbox.
void vtkBoundingBox::AddBounds | ( | const double | bounds[] | ) |
Adjust the bounding box so it contains the specified bounds (defined by the VTK representation (xmin,xmax, ymin,ymax, zmin,zmax).
int vtkBoundingBox::IntersectBox | ( | const vtkBoundingBox & | bbox | ) |
Intersect this box with bbox.
The method returns 1 if both boxes are valid and they do have overlap else it will return 0. If 0 is returned the box has not been modified.
int vtkBoundingBox::Intersects | ( | const vtkBoundingBox & | bbox | ) | const |
Returns 1 if the boxes intersect else returns 0.
Intersect this box with the half space defined by plane.
Returns true if there is intersection—which implies that the box has been modified Returns false otherwise.
int vtkBoundingBox::Contains | ( | const vtkBoundingBox & | bbox | ) | const |
Returns 1 if the min and max points of bbox are contained within the bounds of the specified box, else returns 0.
|
inline |
Get the bounds of the box (defined by VTK style).
Definition at line 371 of file vtkBoundingBox.h.
|
inline |
Get the bounds of the box (defined by VTK style).
Definition at line 288 of file vtkBoundingBox.h.
Return the ith bounds of the box (defined by VTK style).
Definition at line 300 of file vtkBoundingBox.h.
|
inline |
Get the minimum point of the bounding box.
Definition at line 308 of file vtkBoundingBox.h.
Get the minimum point of the bounding box.
Definition at line 444 of file vtkBoundingBox.h.
|
inline |
Get the minimum point of the bounding box.
Definition at line 313 of file vtkBoundingBox.h.
|
inline |
Get the maximum point of the bounding box.
Definition at line 320 of file vtkBoundingBox.h.
Get the maximum point of the bounding box.
Definition at line 451 of file vtkBoundingBox.h.
|
inline |
Get the maximum point of the bounding box.
Definition at line 325 of file vtkBoundingBox.h.
Get the ith corner of the bounding box.
The points are ordered with i, then j, then k increasing.
Definition at line 481 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the point is contained in the box else 0.
Definition at line 476 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the point is contained in the box else 0.
Definition at line 458 of file vtkBoundingBox.h.
|
inline |
Get the center of the bounding box.
Definition at line 358 of file vtkBoundingBox.h.
|
inline |
Get the length of each sode of the box.
Definition at line 351 of file vtkBoundingBox.h.
Return the length of the bounding box in the ith direction.
Definition at line 346 of file vtkBoundingBox.h.
double vtkBoundingBox::GetMaxLength | ( | ) | const |
Return the maximum length of the box.
double vtkBoundingBox::GetDiagonalLength | ( | ) | const |
Return the length of the diagonal.
void vtkBoundingBox::Inflate | ( | double | delta | ) |
Expand the bounding box.
Inflate(delta) expands by delta on each side, the box will grow by 2*delta in x, y, and z. Inflate(dx,dy,dz) expands by the given amounts in each of the x, y, z directions. Finally, Inflate() expands the bounds so that it has non-zero volume. Edges that are inflated are adjusted 1% of the longest edge. Or if an edge is zero length, the bounding box is inflated by 1 unit in that direction.
Expand the bounding box.
Inflate(delta) expands by delta on each side, the box will grow by 2*delta in x, y, and z. Inflate(dx,dy,dz) expands by the given amounts in each of the x, y, z directions. Finally, Inflate() expands the bounds so that it has non-zero volume. Edges that are inflated are adjusted 1% of the longest edge. Or if an edge is zero length, the bounding box is inflated by 1 unit in that direction.
void vtkBoundingBox::Inflate | ( | ) |
Expand the bounding box.
Inflate(delta) expands by delta on each side, the box will grow by 2*delta in x, y, and z. Inflate(dx,dy,dz) expands by the given amounts in each of the x, y, z directions. Finally, Inflate() expands the bounds so that it has non-zero volume. Edges that are inflated are adjusted 1% of the longest edge. Or if an edge is zero length, the bounding box is inflated by 1 unit in that direction.
void vtkBoundingBox::Scale | ( | double | s[3] | ) |
Scale each dimension of the box by some given factor.
If the box is not valid, it stays unchanged. If the scalar factor is negative, bounds are flipped: for example, if (xMin,xMax)=(-2,4) and sx=-3, (xMin,xMax) becomes (-12,6).
Scale each dimension of the box by some given factor.
If the box is not valid, it stays unchanged. If the scalar factor is negative, bounds are flipped: for example, if (xMin,xMax)=(-2,4) and sx=-3, (xMin,xMax) becomes (-12,6).
void vtkBoundingBox::ScaleAboutCenter | ( | double | s | ) |
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling.
If the box is not valid, it is not changed.
void vtkBoundingBox::ScaleAboutCenter | ( | double | s[3] | ) |
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling.
If the box is not valid, it is not changed.
Scale each dimension of the box by some given factor, with the origin of the bounding box the center of the scaling.
If the box is not valid, it is not changed.
vtkIdType vtkBoundingBox::ComputeDivisions | ( | vtkIdType | totalBins, |
double | bounds[6], | ||
int | divs[3] | ||
) | const |
Compute the number of divisions in the z-y-z directions given a target number of total bins (i.e., product of divisions in the x-y-z directions).
The computation is done in such a way as to create near cuboid bins. Also note that the returned bounds may be different than the bounds defined in this class, as the bounds in the z-y-z directions can never be <= 0. Note that the total number of divisions (divs[0]*divs[1]*divs[2]) is guaranteed to be smaller than the target number of bins.
|
inline |
Returns the box to its initialized state.
Definition at line 282 of file vtkBoundingBox.h.
|
protected |
Definition at line 279 of file vtkBoundingBox.h.
|
protected |
Definition at line 279 of file vtkBoundingBox.h.