Open CASCADE Technology  7.3.1.dev
Public Member Functions | Protected Types
Bnd_Box Class Reference

Describes a bounding box in 3D space. A bounding box is parallel to the axes of the coordinates system. If it is finite, it is defined by the three intervals: More...

#include <Bnd_Box.hxx>

Public Member Functions

 Bnd_Box ()
 Creates an empty Box. The constructed box is qualified Void. Its gap is null. More...
 
void SetWhole ()
 Sets this bounding box so that it covers the whole of 3D space. It is infinitely long in all directions. More...
 
void SetVoid ()
 Sets this bounding box so that it is empty. All points are outside a void box. More...
 
void Set (const gp_Pnt &P)
 Sets this bounding box so that it bounds. More...
 
void Set (const gp_Pnt &P, const gp_Dir &D)
 Sets this bounding box so that it bounds the half-line defined by point P and direction D, i.e. all points M defined by M=P+u*D, where u is greater than or equal to 0, are inside the bounding volume. This involves first setting this box to be void and then adding the half-line. More...
 
void Update (const Standard_Real aXmin, const Standard_Real aYmin, const Standard_Real aZmin, const Standard_Real aXmax, const Standard_Real aYmax, const Standard_Real aZmax)
 Enlarges this bounding box, if required, so that it contains at least: More...
 
void Update (const Standard_Real X, const Standard_Real Y, const Standard_Real Z)
 Adds a point of coordinates (X,Y,Z) to this bounding box. More...
 
Standard_Real GetGap () const
 Returns the gap of this bounding box. More...
 
void SetGap (const Standard_Real Tol)
 Set the gap of this bounding box to abs(Tol). More...
 
void Enlarge (const Standard_Real Tol)
 Enlarges the box with a tolerance value. (minvalues-Abs(<tol>) and maxvalues+Abs(<tol>)) This means that the minimum values of its X, Y and Z intervals of definition, when they are finite, are reduced by the absolute value of Tol, while the maximum values are increased by the same amount. More...
 
void Get (Standard_Real &theXmin, Standard_Real &theYmin, Standard_Real &theZmin, Standard_Real &theXmax, Standard_Real &theYmax, Standard_Real &theZmax) const
 Returns the bounds of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid() More...
 
gp_Pnt CornerMin () const
 Returns the lower corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid() More...
 
gp_Pnt CornerMax () const
 Returns the upper corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid() More...
 
void OpenXmin ()
 The Box will be infinitely long in the Xmin direction. More...
 
void OpenXmax ()
 The Box will be infinitely long in the Xmax direction. More...
 
void OpenYmin ()
 The Box will be infinitely long in the Ymin direction. More...
 
void OpenYmax ()
 The Box will be infinitely long in the Ymax direction. More...
 
void OpenZmin ()
 The Box will be infinitely long in the Zmin direction. More...
 
void OpenZmax ()
 The Box will be infinitely long in the Zmax direction. More...
 
Standard_Boolean IsOpen () const
 Returns true if this bounding box has at least one open direction. More...
 
Standard_Boolean IsOpenXmin () const
 Returns true if this bounding box is open in the Xmin direction. More...
 
Standard_Boolean IsOpenXmax () const
 Returns true if this bounding box is open in the Xmax direction. More...
 
Standard_Boolean IsOpenYmin () const
 Returns true if this bounding box is open in the Ymix direction. More...
 
Standard_Boolean IsOpenYmax () const
 Returns true if this bounding box is open in the Ymax direction. More...
 
Standard_Boolean IsOpenZmin () const
 Returns true if this bounding box is open in the Zmin direction. More...
 
Standard_Boolean IsOpenZmax () const
 Returns true if this bounding box is open in the Zmax direction. More...
 
Standard_Boolean IsWhole () const
 Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag). More...
 
Standard_Boolean IsVoid () const
 Returns true if this bounding box is empty (Void flag). More...
 
Standard_Boolean IsXThin (const Standard_Real tol) const
 true if xmax-xmin < tol. More...
 
Standard_Boolean IsYThin (const Standard_Real tol) const
 true if ymax-ymin < tol. More...
 
Standard_Boolean IsZThin (const Standard_Real tol) const
 true if zmax-zmin < tol. More...
 
Standard_Boolean IsThin (const Standard_Real tol) const
 Returns true if IsXThin, IsYThin and IsZThin are all true, i.e. if the box is thin in all three dimensions. More...
 
Bnd_Box Transformed (const gp_Trsf &T) const
 Returns a bounding box which is the result of applying the transformation T to this bounding box. Warning Applying a geometric transformation (for example, a rotation) to a bounding box generally increases its dimensions. This is not optimal for algorithms which use it. More...
 
void Add (const Bnd_Box &Other)
 Adds the box <Other> to <me>. More...
 
void Add (const gp_Pnt &P)
 Adds a Pnt to the box. More...
 
void Add (const gp_Pnt &P, const gp_Dir &D)
 Extends <me> from the Pnt. More...
 
void Add (const gp_Dir &D)
 Extends the Box in the given Direction, i.e. adds an half-line. The box may become infinite in 1,2 or 3 directions. More...
 
Standard_Boolean IsOut (const gp_Pnt &P) const
 Returns True if the Pnt is out the box. More...
 
Standard_Boolean IsOut (const gp_Lin &L) const
 Returns False if the line intersects the box. More...
 
Standard_Boolean IsOut (const gp_Pln &P) const
 Returns False if the plane intersects the box. More...
 
Standard_Boolean IsOut (const Bnd_Box &Other) const
 Returns False if the <Box> intersects or is inside <me>. More...
 
Standard_Boolean IsOut (const Bnd_Box &Other, const gp_Trsf &T) const
 Returns False if the transformed <Box> intersects or is inside <me>. More...
 
Standard_Boolean IsOut (const gp_Trsf &T1, const Bnd_Box &Other, const gp_Trsf &T2) const
 Returns False if the transformed <Box> intersects or is inside the transformed box <me>. More...
 
Standard_Boolean IsOut (const gp_Pnt &P1, const gp_Pnt &P2, const gp_Dir &D) const
 Returns False if the flat band lying between two parallel lines represented by their reference points <P1>, <P2> and direction <D> intersects the box. More...
 
Standard_Real Distance (const Bnd_Box &Other) const
 Computes the minimum distance between two boxes. More...
 
void Dump () const
 
Standard_Real SquareExtent () const
 Computes the squared diagonal of me. More...
 
Bnd_Box FinitePart () const
 Returns a finite part of an infinite bounding box (returns self if this is already finite box). This can be a Void box in case if its sides has been defined as infinite (Open) without adding any finite points. WARNING! This method relies on Open flags, the infinite points added using Add() method will be returned as is. More...
 
Standard_Boolean HasFinitePart () const
 Returns TRUE if this box has finite part. More...
 

Protected Types

enum  MaskFlags {
  VoidMask = 0x01, XminMask = 0x02, XmaxMask = 0x04, YminMask = 0x08,
  YmaxMask = 0x10, ZminMask = 0x20, ZmaxMask = 0x40, WholeMask = 0x7e
}
 Bit flags. More...
 

Detailed Description

Describes a bounding box in 3D space. A bounding box is parallel to the axes of the coordinates system. If it is finite, it is defined by the three intervals:

Member Enumeration Documentation

◆ MaskFlags

enum Bnd_Box::MaskFlags
protected

Bit flags.

Enumerator
VoidMask 
XminMask 
XmaxMask 
YminMask 
YmaxMask 
ZminMask 
ZmaxMask 
WholeMask 

Constructor & Destructor Documentation

◆ Bnd_Box()

Bnd_Box::Bnd_Box ( )

Creates an empty Box. The constructed box is qualified Void. Its gap is null.

Member Function Documentation

◆ Add() [1/4]

void Bnd_Box::Add ( const Bnd_Box Other)

Adds the box <Other> to <me>.

◆ Add() [2/4]

void Bnd_Box::Add ( const gp_Pnt P)

Adds a Pnt to the box.

◆ Add() [3/4]

void Bnd_Box::Add ( const gp_Pnt P,
const gp_Dir D 
)

Extends <me> from the Pnt.

in the direction <D>.

◆ Add() [4/4]

void Bnd_Box::Add ( const gp_Dir D)

Extends the Box in the given Direction, i.e. adds an half-line. The box may become infinite in 1,2 or 3 directions.

◆ CornerMax()

gp_Pnt Bnd_Box::CornerMax ( ) const

Returns the upper corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid()

◆ CornerMin()

gp_Pnt Bnd_Box::CornerMin ( ) const

Returns the lower corner of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid()

◆ Distance()

Standard_Real Bnd_Box::Distance ( const Bnd_Box Other) const

Computes the minimum distance between two boxes.

◆ Dump()

void Bnd_Box::Dump ( ) const

◆ Enlarge()

void Bnd_Box::Enlarge ( const Standard_Real  Tol)

Enlarges the box with a tolerance value. (minvalues-Abs(<tol>) and maxvalues+Abs(<tol>)) This means that the minimum values of its X, Y and Z intervals of definition, when they are finite, are reduced by the absolute value of Tol, while the maximum values are increased by the same amount.

◆ FinitePart()

Bnd_Box Bnd_Box::FinitePart ( ) const
inline

Returns a finite part of an infinite bounding box (returns self if this is already finite box). This can be a Void box in case if its sides has been defined as infinite (Open) without adding any finite points. WARNING! This method relies on Open flags, the infinite points added using Add() method will be returned as is.

◆ Get()

void Bnd_Box::Get ( Standard_Real theXmin,
Standard_Real theYmin,
Standard_Real theZmin,
Standard_Real theXmax,
Standard_Real theYmax,
Standard_Real theZmax 
) const

Returns the bounds of this bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). Standard_ConstructionError exception will be thrown if the box is void. if IsVoid()

◆ GetGap()

Standard_Real Bnd_Box::GetGap ( ) const

Returns the gap of this bounding box.

◆ HasFinitePart()

Standard_Boolean Bnd_Box::HasFinitePart ( ) const
inline

Returns TRUE if this box has finite part.

◆ IsOpen()

Standard_Boolean Bnd_Box::IsOpen ( ) const
inline

Returns true if this bounding box has at least one open direction.

◆ IsOpenXmax()

Standard_Boolean Bnd_Box::IsOpenXmax ( ) const
inline

Returns true if this bounding box is open in the Xmax direction.

◆ IsOpenXmin()

Standard_Boolean Bnd_Box::IsOpenXmin ( ) const
inline

Returns true if this bounding box is open in the Xmin direction.

◆ IsOpenYmax()

Standard_Boolean Bnd_Box::IsOpenYmax ( ) const
inline

Returns true if this bounding box is open in the Ymax direction.

◆ IsOpenYmin()

Standard_Boolean Bnd_Box::IsOpenYmin ( ) const
inline

Returns true if this bounding box is open in the Ymix direction.

◆ IsOpenZmax()

Standard_Boolean Bnd_Box::IsOpenZmax ( ) const
inline

Returns true if this bounding box is open in the Zmax direction.

◆ IsOpenZmin()

Standard_Boolean Bnd_Box::IsOpenZmin ( ) const
inline

Returns true if this bounding box is open in the Zmin direction.

◆ IsOut() [1/7]

Standard_Boolean Bnd_Box::IsOut ( const gp_Pnt P) const

Returns True if the Pnt is out the box.

◆ IsOut() [2/7]

Standard_Boolean Bnd_Box::IsOut ( const gp_Lin L) const

Returns False if the line intersects the box.

◆ IsOut() [3/7]

Standard_Boolean Bnd_Box::IsOut ( const gp_Pln P) const

Returns False if the plane intersects the box.

◆ IsOut() [4/7]

Standard_Boolean Bnd_Box::IsOut ( const Bnd_Box Other) const

Returns False if the <Box> intersects or is inside <me>.

◆ IsOut() [5/7]

Standard_Boolean Bnd_Box::IsOut ( const Bnd_Box Other,
const gp_Trsf T 
) const

Returns False if the transformed <Box> intersects or is inside <me>.

◆ IsOut() [6/7]

Standard_Boolean Bnd_Box::IsOut ( const gp_Trsf T1,
const Bnd_Box Other,
const gp_Trsf T2 
) const

Returns False if the transformed <Box> intersects or is inside the transformed box <me>.

◆ IsOut() [7/7]

Standard_Boolean Bnd_Box::IsOut ( const gp_Pnt P1,
const gp_Pnt P2,
const gp_Dir D 
) const

Returns False if the flat band lying between two parallel lines represented by their reference points <P1>, <P2> and direction <D> intersects the box.

◆ IsThin()

Standard_Boolean Bnd_Box::IsThin ( const Standard_Real  tol) const

Returns true if IsXThin, IsYThin and IsZThin are all true, i.e. if the box is thin in all three dimensions.

◆ IsVoid()

Standard_Boolean Bnd_Box::IsVoid ( ) const
inline

Returns true if this bounding box is empty (Void flag).

◆ IsWhole()

Standard_Boolean Bnd_Box::IsWhole ( ) const
inline

Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).

◆ IsXThin()

Standard_Boolean Bnd_Box::IsXThin ( const Standard_Real  tol) const

true if xmax-xmin < tol.

◆ IsYThin()

Standard_Boolean Bnd_Box::IsYThin ( const Standard_Real  tol) const

true if ymax-ymin < tol.

◆ IsZThin()

Standard_Boolean Bnd_Box::IsZThin ( const Standard_Real  tol) const

true if zmax-zmin < tol.

◆ OpenXmax()

void Bnd_Box::OpenXmax ( )
inline

The Box will be infinitely long in the Xmax direction.

◆ OpenXmin()

void Bnd_Box::OpenXmin ( )
inline

The Box will be infinitely long in the Xmin direction.

◆ OpenYmax()

void Bnd_Box::OpenYmax ( )
inline

The Box will be infinitely long in the Ymax direction.

◆ OpenYmin()

void Bnd_Box::OpenYmin ( )
inline

The Box will be infinitely long in the Ymin direction.

◆ OpenZmax()

void Bnd_Box::OpenZmax ( )
inline

The Box will be infinitely long in the Zmax direction.

◆ OpenZmin()

void Bnd_Box::OpenZmin ( )
inline

The Box will be infinitely long in the Zmin direction.

◆ Set() [1/2]

void Bnd_Box::Set ( const gp_Pnt P)

Sets this bounding box so that it bounds.

  • the point P. This involves first setting this bounding box to be void and then adding the point P.

◆ Set() [2/2]

void Bnd_Box::Set ( const gp_Pnt P,
const gp_Dir D 
)

Sets this bounding box so that it bounds the half-line defined by point P and direction D, i.e. all points M defined by M=P+u*D, where u is greater than or equal to 0, are inside the bounding volume. This involves first setting this box to be void and then adding the half-line.

◆ SetGap()

void Bnd_Box::SetGap ( const Standard_Real  Tol)

Set the gap of this bounding box to abs(Tol).

◆ SetVoid()

void Bnd_Box::SetVoid ( )
inline

Sets this bounding box so that it is empty. All points are outside a void box.

◆ SetWhole()

void Bnd_Box::SetWhole ( )
inline

Sets this bounding box so that it covers the whole of 3D space. It is infinitely long in all directions.

◆ SquareExtent()

Standard_Real Bnd_Box::SquareExtent ( ) const
inline

Computes the squared diagonal of me.

◆ Transformed()

Bnd_Box Bnd_Box::Transformed ( const gp_Trsf T) const

Returns a bounding box which is the result of applying the transformation T to this bounding box. Warning Applying a geometric transformation (for example, a rotation) to a bounding box generally increases its dimensions. This is not optimal for algorithms which use it.

◆ Update() [1/2]

void Bnd_Box::Update ( const Standard_Real  aXmin,
const Standard_Real  aYmin,
const Standard_Real  aZmin,
const Standard_Real  aXmax,
const Standard_Real  aYmax,
const Standard_Real  aZmax 
)

Enlarges this bounding box, if required, so that it contains at least:

  • interval [ aXmin,aXmax ] in the "X Direction",
  • interval [ aYmin,aYmax ] in the "Y Direction",
  • interval [ aZmin,aZmax ] in the "Z Direction";

◆ Update() [2/2]

void Bnd_Box::Update ( const Standard_Real  X,
const Standard_Real  Y,
const Standard_Real  Z 
)

Adds a point of coordinates (X,Y,Z) to this bounding box.


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