Open CASCADE Technology  7.7.0
Public Member Functions | Protected Member Functions
Bnd_OBB Class Reference

The class describes the Oriented Bounding Box (OBB), much tighter enclosing volume for the shape than the Axis Aligned Bounding Box (AABB). The OBB is defined by a center of the box, the axes and the halves of its three dimensions. The OBB can be used more effectively than AABB as a rejection mechanism for non-interfering objects. More...

#include <Bnd_OBB.hxx>

Public Member Functions

 Bnd_OBB ()
 Empty constructor. More...
 
 Bnd_OBB (const gp_Pnt &theCenter, const gp_Dir &theXDirection, const gp_Dir &theYDirection, const gp_Dir &theZDirection, const Standard_Real theHXSize, const Standard_Real theHYSize, const Standard_Real theHZSize)
 Constructor taking all defining parameters. More...
 
 Bnd_OBB (const Bnd_Box &theBox)
 Constructor to create OBB from AABB. More...
 
void ReBuild (const TColgp_Array1OfPnt &theListOfPoints, const TColStd_Array1OfReal *theListOfTolerances=0, const Standard_Boolean theIsOptimal=Standard_False)
 Creates new OBB covering every point in theListOfPoints. Tolerance of every such point is set by *theListOfTolerances array. If this array is not void (not null-pointer) then the resulted Bnd_OBB will be enlarged using tolerances of points lying on the box surface. <theIsOptimal> flag defines the mode in which the OBB will be built. Constructing Optimal box takes more time, but the resulting box is usually more tight. In case of construction of Optimal OBB more possible axes are checked. More...
 
void SetCenter (const gp_Pnt &theCenter)
 Sets the center of OBB. More...
 
void SetXComponent (const gp_Dir &theXDirection, const Standard_Real theHXSize)
 Sets the X component of OBB - direction and size. More...
 
void SetYComponent (const gp_Dir &theYDirection, const Standard_Real theHYSize)
 Sets the Y component of OBB - direction and size. More...
 
void SetZComponent (const gp_Dir &theZDirection, const Standard_Real theHZSize)
 Sets the Z component of OBB - direction and size. More...
 
gp_Ax3 Position () const
 Returns the local coordinates system of this oriented box. So that applying it to axis-aligned box ((-XHSize, -YHSize, -ZHSize), (XHSize, YHSize, ZHSize)) will produce this oriented box. More...
 
const gp_XYZCenter () const
 Returns the center of OBB. More...
 
const gp_XYZXDirection () const
 Returns the X Direction of OBB. More...
 
const gp_XYZYDirection () const
 Returns the Y Direction of OBB. More...
 
const gp_XYZZDirection () const
 Returns the Z Direction of OBB. More...
 
Standard_Real XHSize () const
 Returns the X Dimension of OBB. More...
 
Standard_Real YHSize () const
 Returns the Y Dimension of OBB. More...
 
Standard_Real ZHSize () const
 Returns the Z Dimension of OBB. More...
 
Standard_Boolean IsVoid () const
 Checks if the box is empty. More...
 
void SetVoid ()
 Clears this box. More...
 
void SetAABox (const Standard_Boolean &theFlag)
 Sets the flag for axes aligned box. More...
 
Standard_Boolean IsAABox () const
 Returns TRUE if the box is axes aligned. More...
 
void Enlarge (const Standard_Real theGapAdd)
 Enlarges the box with the given value. More...
 
Standard_Boolean GetVertex (gp_Pnt theP[8]) const
 Returns the array of vertices in <this>. The local coordinate of the vertex depending on the index of the array are follow: Index == 0: (-XHSize(), -YHSize(), -ZHSize()) Index == 1: ( XHSize(), -YHSize(), -ZHSize()) Index == 2: (-XHSize(), YHSize(), -ZHSize()) Index == 3: ( XHSize(), YHSize(), -ZHSize()) Index == 4: (-XHSize(), -YHSize(), ZHSize()) Index == 5: ( XHSize(), -YHSize(), ZHSize()) Index == 6: (-XHSize(), YHSize(), ZHSize()) Index == 7: ( XHSize(), YHSize(), ZHSize()). More...
 
Standard_Real SquareExtent () const
 Returns square diagonal of this box. More...
 
Standard_Boolean IsOut (const Bnd_OBB &theOther) const
 Check if the box do not interfere the other box. More...
 
Standard_Boolean IsOut (const gp_Pnt &theP) const
 Check if the point is inside of <this>. More...
 
Standard_Boolean IsCompletelyInside (const Bnd_OBB &theOther) const
 Check if the theOther is completely inside *this. More...
 
void Add (const Bnd_OBB &theOther)
 Rebuilds this in order to include all previous objects (which it was created from) and theOther. More...
 
void Add (const gp_Pnt &theP)
 Rebuilds this in order to include all previous objects (which it was created from) and theP. More...
 
void DumpJson (Standard_OStream &theOStream, Standard_Integer theDepth=-1) const
 Dumps the content of me into the stream. More...
 

Protected Member Functions

void ProcessOnePoint (const gp_Pnt &theP)
 

Detailed Description

The class describes the Oriented Bounding Box (OBB), much tighter enclosing volume for the shape than the Axis Aligned Bounding Box (AABB). The OBB is defined by a center of the box, the axes and the halves of its three dimensions. The OBB can be used more effectively than AABB as a rejection mechanism for non-interfering objects.

Constructor & Destructor Documentation

◆ Bnd_OBB() [1/3]

Bnd_OBB::Bnd_OBB ( )
inline

Empty constructor.

◆ Bnd_OBB() [2/3]

Bnd_OBB::Bnd_OBB ( const gp_Pnt theCenter,
const gp_Dir theXDirection,
const gp_Dir theYDirection,
const gp_Dir theZDirection,
const Standard_Real  theHXSize,
const Standard_Real  theHYSize,
const Standard_Real  theHZSize 
)
inline

Constructor taking all defining parameters.

◆ Bnd_OBB() [3/3]

Bnd_OBB::Bnd_OBB ( const Bnd_Box theBox)
inline

Constructor to create OBB from AABB.

Member Function Documentation

◆ Add() [1/2]

void Bnd_OBB::Add ( const Bnd_OBB theOther)

Rebuilds this in order to include all previous objects (which it was created from) and theOther.

◆ Add() [2/2]

void Bnd_OBB::Add ( const gp_Pnt theP)

Rebuilds this in order to include all previous objects (which it was created from) and theP.

◆ Center()

const gp_XYZ& Bnd_OBB::Center ( ) const
inline

Returns the center of OBB.

◆ DumpJson()

void Bnd_OBB::DumpJson ( Standard_OStream theOStream,
Standard_Integer  theDepth = -1 
) const

Dumps the content of me into the stream.

◆ Enlarge()

void Bnd_OBB::Enlarge ( const Standard_Real  theGapAdd)
inline

Enlarges the box with the given value.

◆ GetVertex()

Standard_Boolean Bnd_OBB::GetVertex ( gp_Pnt  theP[8]) const
inline

Returns the array of vertices in <this>. The local coordinate of the vertex depending on the index of the array are follow: Index == 0: (-XHSize(), -YHSize(), -ZHSize()) Index == 1: ( XHSize(), -YHSize(), -ZHSize()) Index == 2: (-XHSize(), YHSize(), -ZHSize()) Index == 3: ( XHSize(), YHSize(), -ZHSize()) Index == 4: (-XHSize(), -YHSize(), ZHSize()) Index == 5: ( XHSize(), -YHSize(), ZHSize()) Index == 6: (-XHSize(), YHSize(), ZHSize()) Index == 7: ( XHSize(), YHSize(), ZHSize()).

◆ IsAABox()

Standard_Boolean Bnd_OBB::IsAABox ( ) const
inline

Returns TRUE if the box is axes aligned.

◆ IsCompletelyInside()

Standard_Boolean Bnd_OBB::IsCompletelyInside ( const Bnd_OBB theOther) const

Check if the theOther is completely inside *this.

◆ IsOut() [1/2]

Standard_Boolean Bnd_OBB::IsOut ( const Bnd_OBB theOther) const

Check if the box do not interfere the other box.

◆ IsOut() [2/2]

Standard_Boolean Bnd_OBB::IsOut ( const gp_Pnt theP) const

Check if the point is inside of <this>.

◆ IsVoid()

Standard_Boolean Bnd_OBB::IsVoid ( ) const
inline

Checks if the box is empty.

◆ Position()

gp_Ax3 Bnd_OBB::Position ( ) const
inline

Returns the local coordinates system of this oriented box. So that applying it to axis-aligned box ((-XHSize, -YHSize, -ZHSize), (XHSize, YHSize, ZHSize)) will produce this oriented box.

gp_Trsf aLoc;
aLoc.SetTransformation (theOBB.Position(), gp::XOY());

◆ ProcessOnePoint()

void Bnd_OBB::ProcessOnePoint ( const gp_Pnt theP)
inlineprotected

◆ ReBuild()

void Bnd_OBB::ReBuild ( const TColgp_Array1OfPnt theListOfPoints,
const TColStd_Array1OfReal theListOfTolerances = 0,
const Standard_Boolean  theIsOptimal = Standard_False 
)

Creates new OBB covering every point in theListOfPoints. Tolerance of every such point is set by *theListOfTolerances array. If this array is not void (not null-pointer) then the resulted Bnd_OBB will be enlarged using tolerances of points lying on the box surface. <theIsOptimal> flag defines the mode in which the OBB will be built. Constructing Optimal box takes more time, but the resulting box is usually more tight. In case of construction of Optimal OBB more possible axes are checked.

◆ SetAABox()

void Bnd_OBB::SetAABox ( const Standard_Boolean theFlag)
inline

Sets the flag for axes aligned box.

◆ SetCenter()

void Bnd_OBB::SetCenter ( const gp_Pnt theCenter)
inline

Sets the center of OBB.

◆ SetVoid()

void Bnd_OBB::SetVoid ( )
inline

Clears this box.

◆ SetXComponent()

void Bnd_OBB::SetXComponent ( const gp_Dir theXDirection,
const Standard_Real  theHXSize 
)
inline

Sets the X component of OBB - direction and size.

◆ SetYComponent()

void Bnd_OBB::SetYComponent ( const gp_Dir theYDirection,
const Standard_Real  theHYSize 
)
inline

Sets the Y component of OBB - direction and size.

◆ SetZComponent()

void Bnd_OBB::SetZComponent ( const gp_Dir theZDirection,
const Standard_Real  theHZSize 
)
inline

Sets the Z component of OBB - direction and size.

◆ SquareExtent()

Standard_Real Bnd_OBB::SquareExtent ( ) const
inline

Returns square diagonal of this box.

◆ XDirection()

const gp_XYZ& Bnd_OBB::XDirection ( ) const
inline

Returns the X Direction of OBB.

◆ XHSize()

Standard_Real Bnd_OBB::XHSize ( ) const
inline

Returns the X Dimension of OBB.

◆ YDirection()

const gp_XYZ& Bnd_OBB::YDirection ( ) const
inline

Returns the Y Direction of OBB.

◆ YHSize()

Standard_Real Bnd_OBB::YHSize ( ) const
inline

Returns the Y Dimension of OBB.

◆ ZDirection()

const gp_XYZ& Bnd_OBB::ZDirection ( ) const
inline

Returns the Z Direction of OBB.

◆ ZHSize()

Standard_Real Bnd_OBB::ZHSize ( ) const
inline

Returns the Z Dimension of OBB.


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