VTK
9.1.0
|
Fast, simple class for representing and operating on 3D bounds. More...
#include <vtkBoundingBox.h>
Public Member Functions | |
vtkBoundingBox (const vtkBoundingBox &bbox) | |
Copy constructor. | |
vtkBoundingBox & | operator= (const vtkBoundingBox &bbox) |
Assignment Operator. | |
void | AddBox (const vtkBoundingBox &bbox) |
Change the bounding box to be the union of itself and the specified bbox. | |
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). | |
bool | IsSubsetOf (const vtkBoundingBox &bbox) const |
Returns true if this instance is entirely contained by bbox. | |
int | IntersectBox (const vtkBoundingBox &bbox) |
Intersect this box with bbox. | |
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. | |
bool | IntersectsSphere (double center[3], double squaredRadius) const |
Intersect this box with a sphere. | |
bool | IntersectsLine (const double p1[3], const double p2[3]) const |
Returns true if any part of segment [p1,p2] lies inside the bounding box, as well as on its boundaries. | |
int | ComputeInnerDimension () const |
Returns the inner dimension 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, else returns 0. | |
double | GetBound (int i) const |
Return the ith bounds of the box (defined by VTK style). | |
void | GetCorner (int corner, double p[3]) const |
Get the ith corner of the bounding box. | |
void | GetCenter (double center[3]) const |
Get the center of the bounding box. | |
void | GetLengths (double lengths[3]) const |
Get the length of each side of the box. | |
double | GetLength (int i) const |
Return the length of the bounding box in the ith direction. | |
double | GetMaxLength () const |
Return the maximum length of the box. | |
double | GetDiagonalLength () const |
Return the length of the diagonal. | |
vtkIdType | ComputeDivisions (vtkIdType totalBins, double bounds[6], int divs[3]) const |
Compute the number of divisions in the x-y-z directions given a psoitive, target number of total bins (i.e., product of divisions in the x-y-z directions). | |
void | Reset () |
Returns the box to its initialized state. | |
vtkBoundingBox () | |
Construct a bounding box with the min point set to VTK_DOUBLE_MAX and the max point set to VTK_DOUBLE_MIN. | |
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. | |
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. | |
bool | operator== (const vtkBoundingBox &bbox) const |
Equality operator. | |
bool | operator!= (const vtkBoundingBox &bbox) const |
Equality operator. | |
void | SetBounds (const double bounds[6]) |
Set the bounds explicitly of the box (using the VTK convention for representing a bounding box). | |
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). | |
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. | |
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. | |
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. | |
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. | |
void | AddPoint (double p[3]) |
Change bounding box so it includes the point p. | |
void | AddPoint (double px, double py, double pz) |
Change bounding box so it includes the point p. | |
void | GetBounds (double bounds[6]) const |
Get the bounds of the box (defined by VTK style). | |
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). | |
const double * | GetMinPoint () const |
Get the minimum point of the bounding box. | |
void | GetMinPoint (double &x, double &y, double &z) const |
Get the minimum point of the bounding box. | |
void | GetMinPoint (double x[3]) const |
Get the minimum point of the bounding box. | |
const double * | GetMaxPoint () const |
Get the maximum point of the bounding box. | |
void | GetMaxPoint (double &x, double &y, double &z) const |
Get the maximum point of the bounding box. | |
void | GetMaxPoint (double x[3]) const |
Get the maximum point of the bounding box. | |
vtkTypeBool | ContainsPoint (const double p[3]) const |
Returns 1 if the point is contained in the box else 0. | |
vtkTypeBool | ContainsPoint (double px, double py, double pz) const |
Returns 1 if the point is contained in the box else 0. | |
template<class PointT > | |
bool | ContainsPoint (const PointT &p) const |
Returns 1 if the point is contained in the box else 0. | |
void | Inflate (double delta) |
Expand the bounding box. | |
void | Inflate (double deltaX, double deltaY, double deltaZ) |
Expand the bounding box. | |
void | Inflate () |
Expand the bounding box. | |
void | Scale (double s[3]) |
Scale each dimension of the box by some given factor. | |
void | Scale (double sx, double sy, double sz) |
Scale each dimension of the box by some given factor. | |
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. | |
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. | |
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. | |
Static Public Member Functions | |
static void | ClampDivisions (vtkIdType targetBins, int divs[3]) |
Clamp the number of divisions to be less than or equal to a target number of bins, and the divs[i] >= 1. | |
static void | ComputeLocalBounds (vtkPoints *points, double u[3], double v[3], double w[3], double outputBounds[6]) |
Compute local bounds. | |
Protected Attributes | |
double | MinPnt [3] |
double | MaxPnt [3] |
void | ComputeBounds (vtkPoints *pts) |
Compute the bounding box from an array of vtkPoints. | |
void | ComputeBounds (vtkPoints *pts, unsigned char *ptUses) |
Compute the bounding box from an array of vtkPoints. | |
static void | ComputeBounds (vtkPoints *pts, double bounds[6]) |
Compute the bounding box from an array of vtkPoints. | |
static void | ComputeBounds (vtkPoints *pts, const unsigned char *ptUses, double bounds[6]) |
Compute the bounding box from an array of vtkPoints. | |
static void | ComputeBounds (vtkPoints *pts, const std::atomic< unsigned char > *ptUses, double bounds[6]) |
Compute the bounding box from an array of vtkPoints. | |
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. | |
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. | |
Fast, simple class for representing and operating on 3D bounds.
vtkBoundingBox maintains and performs operations on 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 65 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 470 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 475 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 481 of file vtkBoundingBox.h.
|
inline |
Copy constructor.
Definition at line 488 of file vtkBoundingBox.h.
|
inline |
Assignment Operator.
Definition at line 499 of file vtkBoundingBox.h.
|
inline |
Equality operator.
Definition at line 511 of file vtkBoundingBox.h.
|
inline |
Equality operator.
Definition at line 518 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 460 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.
|
static |
Compute the bounding box from an array of vtkPoints.
It uses a fast (i.e., threaded) path when possible. The second signature (with point uses) only considers points with ptUses[i] != 0 in the bounds calculation. The non-static ComputeBounds() methods update the current bounds of an instance of this class.
|
static |
Compute the bounding box from an array of vtkPoints.
It uses a fast (i.e., threaded) path when possible. The second signature (with point uses) only considers points with ptUses[i] != 0 in the bounds calculation. The non-static ComputeBounds() methods update the current bounds of an instance of this class.
|
static |
Compute the bounding box from an array of vtkPoints.
It uses a fast (i.e., threaded) path when possible. The second signature (with point uses) only considers points with ptUses[i] != 0 in the bounds calculation. The non-static ComputeBounds() methods update the current bounds of an instance of this class.
|
inline |
Compute the bounding box from an array of vtkPoints.
It uses a fast (i.e., threaded) path when possible. The second signature (with point uses) only considers points with ptUses[i] != 0 in the bounds calculation. The non-static ComputeBounds() methods update the current bounds of an instance of this class.
Definition at line 117 of file vtkBoundingBox.h.
|
inline |
Compute the bounding box from an array of vtkPoints.
It uses a fast (i.e., threaded) path when possible. The second signature (with point uses) only considers points with ptUses[i] != 0 in the bounds calculation. The non-static ComputeBounds() methods update the current bounds of an instance of this class.
Definition at line 118 of file vtkBoundingBox.h.
|
static |
Compute local bounds.
Not as fast as vtkPoints.getBounds() if u, v, w form a natural basis.
void vtkBoundingBox::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.
|
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 523 of file vtkBoundingBox.h.
void vtkBoundingBox::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.
|
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 528 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 421 of file vtkBoundingBox.h.
|
inlinestatic |
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 427 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.
void vtkBoundingBox::AddPoint | ( | double | px, |
double | py, | ||
double | pz | ||
) |
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).
|
inline |
Returns true if this instance is entirely contained by bbox.
Definition at line 451 of file vtkBoundingBox.h.
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.
bool vtkBoundingBox::IntersectPlane | ( | double | origin[3], |
double | normal[3] | ||
) |
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.
bool vtkBoundingBox::IntersectsSphere | ( | double | center[3], |
double | squaredRadius | ||
) | const |
Intersect this box with a sphere.
Parameters involve the center of the sphere and the squared radius.
bool vtkBoundingBox::IntersectsLine | ( | const double | p1[3], |
const double | p2[3] | ||
) | const |
Returns true if any part of segment [p1,p2] lies inside the bounding box, as well as on its boundaries.
It returns false otherwise.
int vtkBoundingBox::ComputeInnerDimension | ( | ) | const |
Returns the inner dimension of the bounding box.
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 465 of file vtkBoundingBox.h.
|
inline |
Get the bounds of the box (defined by VTK style).
Definition at line 378 of file vtkBoundingBox.h.
|
inline |
Return the ith bounds of the box (defined by VTK style).
Definition at line 389 of file vtkBoundingBox.h.
|
inline |
Get the minimum point of the bounding box.
Definition at line 397 of file vtkBoundingBox.h.
|
inline |
Get the minimum point of the bounding box.
Definition at line 533 of file vtkBoundingBox.h.
|
inline |
Get the minimum point of the bounding box.
Definition at line 402 of file vtkBoundingBox.h.
|
inline |
Get the maximum point of the bounding box.
Definition at line 409 of file vtkBoundingBox.h.
|
inline |
Get the maximum point of the bounding box.
Definition at line 540 of file vtkBoundingBox.h.
|
inline |
Get the maximum point of the bounding box.
Definition at line 414 of file vtkBoundingBox.h.
|
inline |
Get the ith corner of the bounding box.
The points are ordered with i, then j, then k increasing.
Definition at line 575 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the point is contained in the box else 0.
Definition at line 564 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the point is contained in the box else 0.
Definition at line 547 of file vtkBoundingBox.h.
|
inline |
Returns 1 if the point is contained in the box else 0.
Definition at line 570 of file vtkBoundingBox.h.
|
inline |
Get the center of the bounding box.
Definition at line 444 of file vtkBoundingBox.h.
|
inline |
Get the length of each side of the box.
Definition at line 437 of file vtkBoundingBox.h.
|
inline |
Return the length of the bounding box in the ith direction.
Definition at line 432 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.
void vtkBoundingBox::Inflate | ( | double | deltaX, |
double | deltaY, | ||
double | deltaZ | ||
) |
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).
void vtkBoundingBox::Scale | ( | double | sx, |
double | sy, | ||
double | sz | ||
) |
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.
void vtkBoundingBox::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.
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 x-y-z directions given a psoitive, 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 x-y-z directions can never be <= 0. Note that the total number of divisions (divs[0]*divs[1]*divs[2]) will be less than or equal to the target number of bins (as long as totalBins>=1).
|
static |
Clamp the number of divisions to be less than or equal to a target number of bins, and the divs[i] >= 1.
|
inline |
Returns the box to its initialized state.
Definition at line 372 of file vtkBoundingBox.h.
|
protected |
Definition at line 369 of file vtkBoundingBox.h.
|
protected |
Definition at line 369 of file vtkBoundingBox.h.