VTK
Public Member Functions | Protected Attributes | List of all members
vtkBoundingBox Class Reference

Fast Simple Class for dealing with 3D bounds. More...

#include <vtkBoundingBox.h>

Public Member Functions

 vtkBoundingBox (const vtkBoundingBox &bbox)
 Copy Constructor. More...
 
vtkBoundingBoxoperator= (const vtkBoundingBox &bbox)
 Assignment Operator. More...
 
void AddBox (const vtkBoundingBox &bbox)
 Change the bouding box to be the union of itself and bbox. More...
 
void AddBounds (const double bounds[])
 Change the bounding box so it includes bounds (defined by vtk standard) 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 this box, else returns 0. More...
 
double GetBound (int i) const
 Return the ith bounds of the box (defined by vtk style) More...
 
void GetCenter (double center[3]) const
 Get the center of the bounding box. More...
 
void GetLengths (double lengths[3]) const
 Get the lengths of the box. More...
 
double GetLength (int i) const
 Return the length in the ith direction. More...
 
double GetMaxLength () const
 Return the Max Length of the box. More...
 
double GetDiagonalLength () const
 Return the length of the diagonal. More...
 
void Inflate (double delta)
 Expand the Box by delta on each side, the box will grow by 2*delta in x,y and z. 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 (vtk Style) Returns 1 if the box was changed else 0. More...
 
void SetBounds (double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
 Set the bounds explicitly of the box (vtk Style) Returns 1 if the box was changed else 0. 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 Note that the bounding box may have 0 volume if its bounds were just initialized. More...
 
void 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. 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 doubleGetMinPoint () 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...
 
const doubleGetMaxPoint () 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...
 
int ContainsPoint (double p[3]) const
 Returns 1 if the point is contained in the box else 0;. More...
 
int ContainsPoint (double px, double py, double pz) const
 Returns 1 if the point is contained in the box else 0;. 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...
 

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...
 

Detailed Description

Fast Simple Class for dealing with 3D bounds.

vtkBoundingBox maintains a 3D axis aligned bounding box. It is very lite weight and many of the member functions are in-lined so its very fast It is not derived from vtkObject so it can be allocated on the stack

See also
vtkBox

Definition at line 32 of file vtkBoundingBox.h.

Constructor & Destructor Documentation

◆ vtkBoundingBox() [1/4]

vtkBoundingBox::vtkBoundingBox ( )
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 322 of file vtkBoundingBox.h.

◆ vtkBoundingBox() [2/4]

vtkBoundingBox::vtkBoundingBox ( const double  bounds[6])
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 327 of file vtkBoundingBox.h.

◆ vtkBoundingBox() [3/4]

vtkBoundingBox::vtkBoundingBox ( double  xMin,
double  xMax,
double  yMin,
double  yMax,
double  zMin,
double  zMax 
)
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 333 of file vtkBoundingBox.h.

◆ vtkBoundingBox() [4/4]

vtkBoundingBox::vtkBoundingBox ( const vtkBoundingBox bbox)
inline

Copy Constructor.

Definition at line 341 of file vtkBoundingBox.h.

Member Function Documentation

◆ operator=()

vtkBoundingBox & vtkBoundingBox::operator= ( const vtkBoundingBox bbox)
inline

Assignment Operator.

Definition at line 352 of file vtkBoundingBox.h.

◆ operator==()

bool vtkBoundingBox::operator== ( const vtkBoundingBox bbox) const
inline

Equality Operator.

Definition at line 364 of file vtkBoundingBox.h.

◆ operator!=()

bool vtkBoundingBox::operator!= ( const vtkBoundingBox bbox) const
inline

Equality Operator.

Definition at line 374 of file vtkBoundingBox.h.

◆ SetBounds() [1/2]

void vtkBoundingBox::SetBounds ( const double  bounds[6])
inline

Set the bounds explicitly of the box (vtk Style) Returns 1 if the box was changed else 0.

Definition at line 310 of file vtkBoundingBox.h.

◆ SetBounds() [2/2]

void vtkBoundingBox::SetBounds ( double  xMin,
double  xMax,
double  yMin,
double  yMax,
double  zMin,
double  zMax 
)

Set the bounds explicitly of the box (vtk Style) Returns 1 if the box was changed else 0.

◆ SetMinPoint() [1/2]

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.

◆ SetMinPoint() [2/2]

void vtkBoundingBox::SetMinPoint ( double  p[3])
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 379 of file vtkBoundingBox.h.

◆ SetMaxPoint() [1/2]

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.

◆ SetMaxPoint() [2/2]

void vtkBoundingBox::SetMaxPoint ( double  p[3])
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 384 of file vtkBoundingBox.h.

◆ AddPoint() [1/2]

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.

◆ AddPoint() [2/2]

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.

◆ AddBox()

void vtkBoundingBox::AddBox ( const vtkBoundingBox bbox)

Change the bouding box to be the union of itself and bbox.

◆ AddBounds()

void vtkBoundingBox::AddBounds ( const double  bounds[])

Change the bounding box so it includes bounds (defined by vtk standard)

◆ IntersectBox()

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.

◆ Intersects()

int vtkBoundingBox::Intersects ( const vtkBoundingBox bbox) const

Returns 1 if the boxes intersect else returns 0.

◆ IntersectPlane()

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

◆ Contains()

int vtkBoundingBox::Contains ( const vtkBoundingBox bbox) const

Returns 1 if the min and max points of bbox are contained within the bounds of this box, else returns 0.

◆ GetBounds() [1/2]

void vtkBoundingBox::GetBounds ( double  bounds[6]) const
inline

Get the bounds of the box (defined by vtk style)

Definition at line 316 of file vtkBoundingBox.h.

◆ GetBounds() [2/2]

void vtkBoundingBox::GetBounds ( double xMin,
double xMax,
double yMin,
double yMax,
double zMin,
double zMax 
) const
inline

Get the bounds of the box (defined by vtk style)

Definition at line 247 of file vtkBoundingBox.h.

◆ GetBound()

double vtkBoundingBox::GetBound ( int  i) const
inline

Return the ith bounds of the box (defined by vtk style)

Definition at line 259 of file vtkBoundingBox.h.

◆ GetMinPoint() [1/2]

const double * vtkBoundingBox::GetMinPoint ( ) const
inline

Get the minimum point of the bounding box.

Definition at line 267 of file vtkBoundingBox.h.

◆ GetMinPoint() [2/2]

void vtkBoundingBox::GetMinPoint ( double x,
double y,
double z 
) const
inline

Get the minimum point of the bounding box.

Definition at line 389 of file vtkBoundingBox.h.

◆ GetMaxPoint() [1/2]

const double * vtkBoundingBox::GetMaxPoint ( ) const
inline

Get the maximum point of the bounding box.

Definition at line 272 of file vtkBoundingBox.h.

◆ GetMaxPoint() [2/2]

void vtkBoundingBox::GetMaxPoint ( double x,
double y,
double z 
) const
inline

Get the maximum point of the bounding box.

Definition at line 396 of file vtkBoundingBox.h.

◆ ContainsPoint() [1/2]

int vtkBoundingBox::ContainsPoint ( double  p[3]) const
inline

Returns 1 if the point is contained in the box else 0;.

Definition at line 421 of file vtkBoundingBox.h.

◆ ContainsPoint() [2/2]

int vtkBoundingBox::ContainsPoint ( double  px,
double  py,
double  pz 
) const
inline

Returns 1 if the point is contained in the box else 0;.

Definition at line 403 of file vtkBoundingBox.h.

◆ GetCenter()

void vtkBoundingBox::GetCenter ( double  center[3]) const
inline

Get the center of the bounding box.

Definition at line 303 of file vtkBoundingBox.h.

◆ GetLengths()

void vtkBoundingBox::GetLengths ( double  lengths[3]) const
inline

Get the lengths of the box.

Definition at line 296 of file vtkBoundingBox.h.

◆ GetLength()

double vtkBoundingBox::GetLength ( int  i) const
inline

Return the length in the ith direction.

Definition at line 291 of file vtkBoundingBox.h.

◆ GetMaxLength()

double vtkBoundingBox::GetMaxLength ( ) const

Return the Max Length of the box.

◆ GetDiagonalLength()

double vtkBoundingBox::GetDiagonalLength ( ) const

Return the length of the diagonal.

Precondition
not_empty: this->IsValid()

◆ Inflate()

void vtkBoundingBox::Inflate ( double  delta)

Expand the Box by delta on each side, the box will grow by 2*delta in x,y and z.

◆ IsValid() [1/2]

int vtkBoundingBox::IsValid ( ) const
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 277 of file vtkBoundingBox.h.

◆ IsValid() [2/2]

int vtkBoundingBox::IsValid ( const double  bounds[6])
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 284 of file vtkBoundingBox.h.

◆ Reset()

void vtkBoundingBox::Reset ( )
inline

Returns the box to its initialized state.

Definition at line 241 of file vtkBoundingBox.h.

◆ Scale() [1/2]

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() [2/2]

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).

Member Data Documentation

◆ MinPnt

double vtkBoundingBox::MinPnt[3]
protected

Definition at line 238 of file vtkBoundingBox.h.

◆ MaxPnt

double vtkBoundingBox::MaxPnt[3]
protected

Definition at line 238 of file vtkBoundingBox.h.


The documentation for this class was generated from the following file: