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

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

#include <Bnd_Box2d.hxx>

Public Member Functions

 Bnd_Box2d ()
 Creates an empty 2D bounding box. The constructed box is qualified Void. Its gap is null. More...
 
void SetWhole ()
 Sets this bounding box so that it covers the whole 2D space, i.e. it is infinite in all directions. More...
 
void SetVoid ()
 Sets this 2D bounding box so that it is empty. All points are outside a void box. More...
 
void Set (const gp_Pnt2d &thePnt)
 Sets this 2D bounding box so that it bounds the point P. This involves first setting this bounding box to be void and then adding the point PThe rectangle bounds the point. More...
 
void Set (const gp_Pnt2d &thePnt, const gp_Dir2d &theDir)
 Sets this 2D 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 area. This involves first setting this 2D box to be void and then adding the half-line. More...
 
void Update (const Standard_Real aXmin, const Standard_Real aYmin, const Standard_Real aXmax, const Standard_Real aYmax)
 Enlarges this 2D bounding box, if required, so that it contains at least: More...
 
void Update (const Standard_Real X, const Standard_Real Y)
 Adds a point of coordinates (X,Y) to this bounding box. More...
 
Standard_Real GetGap () const
 Returns the gap of this 2D bounding box. More...
 
void SetGap (const Standard_Real Tol)
 Set the gap of this 2D bounding box to abs(Tol). More...
 
void Enlarge (const Standard_Real theTol)
 Enlarges the box with a tolerance value. This means that the minimum values of its X and Y 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 &aXmin, Standard_Real &aYmin, Standard_Real &aXmax, Standard_Real &aYmax) const
 Returns the bounds of this 2D bounding box. The gap is included. If this bounding box is infinite (i.e. "open"), returned values may be equal to +/- Precision::Infinite(). 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...
 
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 Ymin direction. More...
 
Standard_Boolean IsOpenYmax () const
 Returns true if this bounding box is open in the Ymax direction. More...
 
Standard_Boolean IsWhole () const
 Returns true if this bounding box is infinite in all 4 directions (Whole Space flag). More...
 
Standard_Boolean IsVoid () const
 Returns true if this 2D bounding box is empty (Void flag). More...
 
Bnd_Box2d Transformed (const gp_Trsf2d &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_Box2d &Other)
 Adds the 2d box <Other> to <me>. More...
 
void Add (const gp_Pnt2d &thePnt)
 Adds the 2d point. More...
 
void Add (const gp_Pnt2d &thePnt, const gp_Dir2d &theDir)
 Extends bounding box from thePnt in the direction theDir. More...
 
void Add (const gp_Dir2d &D)
 Extends the Box in the given Direction, i.e. adds a half-line. The box may become infinite in 1 or 2 directions. More...
 
Standard_Boolean IsOut (const gp_Pnt2d &P) const
 Returns True if the 2d pnt. More...
 
Standard_Boolean IsOut (const Bnd_Box2d &Other) const
 Returns True if <Box2d> is out <me>. More...
 
Standard_Boolean IsOut (const Bnd_Box2d &theOther, const gp_Trsf2d &theTrsf) const
 Returns True if transformed <Box2d> is out <me>. More...
 
Standard_Boolean IsOut (const gp_Trsf2d &T1, const Bnd_Box2d &Other, const gp_Trsf2d &T2) const
 Compares a transformed bounding with a transformed bounding. The default implementation is to make a copy of <me> and <Other>, to transform them and to test. More...
 
void Dump () const
 
Standard_Real SquareExtent () const
 Computes the squared diagonal of me. More...
 

Protected Types

enum  MaskFlags {
  VoidMask = 0x01, XminMask = 0x02, XmaxMask = 0x04, YminMask = 0x08,
  YmaxMask = 0x10, WholeMask = 0x1e
}
 Bit flags. More...
 

Detailed Description

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

Member Enumeration Documentation

◆ MaskFlags

enum Bnd_Box2d::MaskFlags
protected

Bit flags.

Enumerator
VoidMask 
XminMask 
XmaxMask 
YminMask 
YmaxMask 
WholeMask 

Constructor & Destructor Documentation

◆ Bnd_Box2d()

Bnd_Box2d::Bnd_Box2d ( )
inline

Creates an empty 2D bounding box. The constructed box is qualified Void. Its gap is null.

Member Function Documentation

◆ Add() [1/4]

void Bnd_Box2d::Add ( const Bnd_Box2d Other)

Adds the 2d box <Other> to <me>.

◆ Add() [2/4]

void Bnd_Box2d::Add ( const gp_Pnt2d thePnt)
inline

Adds the 2d point.

◆ Add() [3/4]

void Bnd_Box2d::Add ( const gp_Pnt2d thePnt,
const gp_Dir2d theDir 
)
inline

Extends bounding box from thePnt in the direction theDir.

◆ Add() [4/4]

void Bnd_Box2d::Add ( const gp_Dir2d D)

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

◆ Dump()

void Bnd_Box2d::Dump ( ) const

◆ Enlarge()

void Bnd_Box2d::Enlarge ( const Standard_Real  theTol)
inline

Enlarges the box with a tolerance value. This means that the minimum values of its X and Y 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.

◆ Get()

void Bnd_Box2d::Get ( Standard_Real aXmin,
Standard_Real aYmin,
Standard_Real aXmax,
Standard_Real aYmax 
) const

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

◆ GetGap()

Standard_Real Bnd_Box2d::GetGap ( ) const
inline

Returns the gap of this 2D bounding box.

◆ IsOpenXmax()

Standard_Boolean Bnd_Box2d::IsOpenXmax ( ) const
inline

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

◆ IsOpenXmin()

Standard_Boolean Bnd_Box2d::IsOpenXmin ( ) const
inline

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

◆ IsOpenYmax()

Standard_Boolean Bnd_Box2d::IsOpenYmax ( ) const
inline

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

◆ IsOpenYmin()

Standard_Boolean Bnd_Box2d::IsOpenYmin ( ) const
inline

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

◆ IsOut() [1/4]

Standard_Boolean Bnd_Box2d::IsOut ( const gp_Pnt2d P) const

Returns True if the 2d pnt.

is out <me>.

◆ IsOut() [2/4]

Standard_Boolean Bnd_Box2d::IsOut ( const Bnd_Box2d Other) const

Returns True if <Box2d> is out <me>.

◆ IsOut() [3/4]

Standard_Boolean Bnd_Box2d::IsOut ( const Bnd_Box2d theOther,
const gp_Trsf2d theTrsf 
) const
inline

Returns True if transformed <Box2d> is out <me>.

◆ IsOut() [4/4]

Standard_Boolean Bnd_Box2d::IsOut ( const gp_Trsf2d T1,
const Bnd_Box2d Other,
const gp_Trsf2d T2 
) const
inline

Compares a transformed bounding with a transformed bounding. The default implementation is to make a copy of <me> and <Other>, to transform them and to test.

◆ IsVoid()

Standard_Boolean Bnd_Box2d::IsVoid ( ) const
inline

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

◆ IsWhole()

Standard_Boolean Bnd_Box2d::IsWhole ( ) const
inline

Returns true if this bounding box is infinite in all 4 directions (Whole Space flag).

◆ OpenXmax()

void Bnd_Box2d::OpenXmax ( )
inline

The Box will be infinitely long in the Xmax direction.

◆ OpenXmin()

void Bnd_Box2d::OpenXmin ( )
inline

The Box will be infinitely long in the Xmin direction.

◆ OpenYmax()

void Bnd_Box2d::OpenYmax ( )
inline

The Box will be infinitely long in the Ymax direction.

◆ OpenYmin()

void Bnd_Box2d::OpenYmin ( )
inline

The Box will be infinitely long in the Ymin direction.

◆ Set() [1/2]

void Bnd_Box2d::Set ( const gp_Pnt2d thePnt)
inline

Sets this 2D bounding box so that it bounds the point P. This involves first setting this bounding box to be void and then adding the point PThe rectangle bounds the point.

.

◆ Set() [2/2]

void Bnd_Box2d::Set ( const gp_Pnt2d thePnt,
const gp_Dir2d theDir 
)
inline

Sets this 2D 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 area. This involves first setting this 2D box to be void and then adding the half-line.

◆ SetGap()

void Bnd_Box2d::SetGap ( const Standard_Real  Tol)
inline

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

◆ SetVoid()

void Bnd_Box2d::SetVoid ( )
inline

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

◆ SetWhole()

void Bnd_Box2d::SetWhole ( )
inline

Sets this bounding box so that it covers the whole 2D space, i.e. it is infinite in all directions.

◆ SquareExtent()

Standard_Real Bnd_Box2d::SquareExtent ( ) const
inline

Computes the squared diagonal of me.

◆ Transformed()

Bnd_Box2d Bnd_Box2d::Transformed ( const gp_Trsf2d 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_Box2d::Update ( const Standard_Real  aXmin,
const Standard_Real  aYmin,
const Standard_Real  aXmax,
const Standard_Real  aYmax 
)

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

  • interval [ aXmin,aXmax ] in the "X Direction",
  • interval [ aYmin,aYmax ] in the "Y Direction"

◆ Update() [2/2]

void Bnd_Box2d::Update ( const Standard_Real  X,
const Standard_Real  Y 
)

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


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