Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Data Structures | 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>

Data Structures

struct  HalfSizes
 Structure containing the OBB half-size dimensions. Can be used with C++17 structured bindings: More...
 

Public Member Functions

 Bnd_OBB ()
 Empty constructor.
 
 Bnd_OBB (const gp_Pnt &theCenter, const gp_Dir &theXDirection, const gp_Dir &theYDirection, const gp_Dir &theZDirection, const double theHXSize, const double theHYSize, const double theHZSize)
 Constructor taking all defining parameters.
 
 Bnd_OBB (const Bnd_Box &theBox)
 Constructor to create OBB from AABB.
 
void ReBuild (const NCollection_Array1< gp_Pnt > &theListOfPoints, const NCollection_Array1< double > *theListOfTolerances=nullptr, const bool theIsOptimal=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.
 
void SetCenter (const gp_Pnt &theCenter)
 Sets the center of OBB.
 
void SetXComponent (const gp_Dir &theXDirection, const double theHXSize)
 Sets the X component of OBB - direction and size.
 
void SetYComponent (const gp_Dir &theYDirection, const double theHYSize)
 Sets the Y component of OBB - direction and size.
 
void SetZComponent (const gp_Dir &theZDirection, const double theHZSize)
 Sets the Z component of OBB - direction and size.
 
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.
 
const gp_XYZCenter () const noexcept
 Returns the center of OBB.
 
const gp_XYZXDirection () const noexcept
 Returns the X Direction of OBB.
 
const gp_XYZYDirection () const noexcept
 Returns the Y Direction of OBB.
 
const gp_XYZZDirection () const noexcept
 Returns the Z Direction of OBB.
 
double XHSize () const noexcept
 Returns the X Dimension of OBB.
 
double YHSize () const noexcept
 Returns the Y Dimension of OBB.
 
double ZHSize () const noexcept
 Returns the Z Dimension of OBB.
 
HalfSizes GetHalfSizes () const noexcept
 Returns the half-size dimensions of the OBB as a HalfSizes structure. Can be used with C++17 structured bindings:
 
bool IsVoid () const noexcept
 Checks if the box is empty.
 
void SetVoid ()
 Clears this box.
 
void SetAABox (const bool &theFlag)
 Sets the flag for axes aligned box.
 
bool IsAABox () const noexcept
 Returns TRUE if the box is axes aligned.
 
void Enlarge (const double theGapAdd)
 Enlarges the box with the given value.
 
bool 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()).
 
double SquareExtent () const noexcept
 Returns square diagonal of this box.
 
bool IsOut (const Bnd_OBB &theOther) const
 Check if the box do not interfere the other box.
 
bool IsOut (const gp_Pnt &theP) const
 Check if the point is inside of <this>.
 
bool Contains (const gp_Pnt &theP) const
 Returns True if the point is inside or on the boundary of this OBB.
 
bool Intersects (const Bnd_OBB &theOther) const
 Returns True if the other OBB intersects or is inside this OBB.
 
bool IsCompletelyInside (const Bnd_OBB &theOther) const
 Check if the theOther is completely inside *this.
 
void Add (const Bnd_OBB &theOther)
 Rebuilds this in order to include all previous objects (which it was created from) and theOther.
 
void Add (const gp_Pnt &theP)
 Rebuilds this in order to include all previous objects (which it was created from) and theP.
 
void DumpJson (Standard_OStream &theOStream, int theDepth=-1) const
 Dumps the content of me into the stream.
 

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 double theHXSize,
const double theHYSize,
const double 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
inlinenoexcept

Returns the center of OBB.

◆ Contains()

bool Bnd_OBB::Contains ( const gp_Pnt & theP) const
inline

Returns True if the point is inside or on the boundary of this OBB.

◆ DumpJson()

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

Dumps the content of me into the stream.

◆ Enlarge()

void Bnd_OBB::Enlarge ( const double theGapAdd)
inline

Enlarges the box with the given value.

◆ GetHalfSizes()

HalfSizes Bnd_OBB::GetHalfSizes ( ) const
inlinenoexcept

Returns the half-size dimensions of the OBB as a HalfSizes structure. Can be used with C++17 structured bindings:

auto [aHX, aHY, aHZ] = anOBB.GetHalfSizes();
STL input iterator that wraps an OCCT More()/Next() iterator.
Definition NCollection_ForwardRange.hxx:142

◆ GetVertex()

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

◆ Intersects()

bool Bnd_OBB::Intersects ( const Bnd_OBB & theOther) const
inline

Returns True if the other OBB intersects or is inside this OBB.

◆ IsAABox()

bool Bnd_OBB::IsAABox ( ) const
inlinenoexcept

Returns TRUE if the box is axes aligned.

◆ IsCompletelyInside()

bool Bnd_OBB::IsCompletelyInside ( const Bnd_OBB & theOther) const

Check if the theOther is completely inside *this.

◆ IsOut() [1/2]

bool Bnd_OBB::IsOut ( const Bnd_OBB & theOther) const

Check if the box do not interfere the other box.

◆ IsOut() [2/2]

bool Bnd_OBB::IsOut ( const gp_Pnt & theP) const

Check if the point is inside of <this>.

◆ IsVoid()

bool Bnd_OBB::IsVoid ( ) const
inlinenoexcept

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.

aLoc.SetTransformation (theOBB.Position(), gp::XOY());
Defines a non-persistent transformation in 3D space. The following transformations are implemented : ...
Definition gp_Trsf.hxx:59
static const gp_Ax2 & XOY() noexcept
Identifies a coordinate system where its origin is Origin, and its "main Direction" and "X Direction"...

◆ ProcessOnePoint()

void Bnd_OBB::ProcessOnePoint ( const gp_Pnt & theP)
inlineprotected

◆ ReBuild()

void Bnd_OBB::ReBuild ( const NCollection_Array1< gp_Pnt > & theListOfPoints,
const NCollection_Array1< double > * theListOfTolerances = nullptr,
const bool theIsOptimal = 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 bool & 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 double theHXSize )
inline

Sets the X component of OBB - direction and size.

◆ SetYComponent()

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

Sets the Y component of OBB - direction and size.

◆ SetZComponent()

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

Sets the Z component of OBB - direction and size.

◆ SquareExtent()

double Bnd_OBB::SquareExtent ( ) const
inlinenoexcept

Returns square diagonal of this box.

◆ XDirection()

const gp_XYZ & Bnd_OBB::XDirection ( ) const
inlinenoexcept

Returns the X Direction of OBB.

◆ XHSize()

double Bnd_OBB::XHSize ( ) const
inlinenoexcept

Returns the X Dimension of OBB.

◆ YDirection()

const gp_XYZ & Bnd_OBB::YDirection ( ) const
inlinenoexcept

Returns the Y Direction of OBB.

◆ YHSize()

double Bnd_OBB::YHSize ( ) const
inlinenoexcept

Returns the Y Dimension of OBB.

◆ ZDirection()

const gp_XYZ & Bnd_OBB::ZDirection ( ) const
inlinenoexcept

Returns the Z Direction of OBB.

◆ ZHSize()

double Bnd_OBB::ZHSize ( ) const
inlinenoexcept

Returns the Z Dimension of OBB.


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