OpenLexocad  27.1
Geom::Bnd_Box Class Reference

#include <Bnd_Box.h>

Public Member Functions

 Bnd_Box ()
 
 Bnd_Box (const Geom::Pnt &min, const Geom::Pnt &max)
 
void SetWhole ()
 
void SetVoid ()
 Sets this bounding box so that it is empty. All points are outside a void box.
More...
 
void Set (const Geom::Pnt &P)
 
void Set (const Geom::Pnt &P, const Geom::Dir &D)
 
void Update (const double aXmin, const double aYmin, const double aZmin, const double aXmax, const double aYmax, const double aZmax)
 
void Update (const double X, const double Y, const double Z)
 Adds a point of coordinates (X,Y,Z) to this bounding box.
More...
 
void SetGap (const double Tol)
 Returns the gap of this bounding box.
More...
 
void Enlarge (const double Tol)
 
void Get (double &aXmin, double &aYmin, double &aZmin, double &aXmax, double &aYmax, double &aZmax) const
 
const double GetXmin () const
 
const double GetYmin () const
 
const double GetZmin () const
 
const double GetXmax () const
 
const double GetYmax () const
 
const double GetZmax () const
 
const double GetXsize () const
 
const double GetYsize () const
 
const double GetZsize () const
 
const Geom::Pnt GetMin () const
 
const Geom::Pnt GetMax () const
 
const Geom::Pnt GetCenter () const
 
void GetSize (double &length, double &width, double &height) const
 
void OpenXmin ()
 
void OpenXmax ()
 
void OpenYmin ()
 
void OpenYmax ()
 
void OpenZmin ()
 
void OpenZmax ()
 
unsigned int IsOpenXmin () const
 Returns true if this bounding box is open in the Xmin direction.
More...
 
unsigned int IsOpenXmax () const
 Returns true if this bounding box is open in the Xmax direction.
More...
 
unsigned int IsOpenYmin () const
 Returns true if this bounding box is open in the Ymix direction.
More...
 
unsigned int IsOpenYmax () const
 Returns true if this bounding box is open in the Ymax direction.
More...
 
unsigned int IsOpenZmin () const
 Returns true if this bounding box is open in the Zmin direction.
More...
 
unsigned int IsOpenZmax () const
 Returns true if this bounding box is open in the Zmax direction.
More...
 
unsigned int IsWhole () const
 Returns true if this bounding box is infinite in all 6 directions (WholeSpace flag).
More...
 
unsigned int IsVoid () const
 Returns true if this bounding box is empty (Void flag).
More...
 
Geom::Bnd_Box Transformed (const Geom::Trsf &T) const
 true if xmax-xmin < tol.
More...
 
void Add (const Bnd_Box &Other)
 Adds the box <Other> to <me>.
More...
 
void Add (const Geom::Pnt &P)
 Adds a Pnt to the box.
More...
 
void Add (const Geom::Pnt &P, const Geom::Dir &D)
 Extends <me> from the Pnt. More...
 
void Add (const Geom::Dir &D)
 
unsigned int IsOut (const Geom::Pnt &P) const
 Returns True if the Pnt is out the box.
More...
 
unsigned int IsOut (const Geom::Lin &L) const
 Returns False if the line intersects the box.
More...
 
unsigned int IsOut (const Geom::Pln &P) const
 Returns False if the plane intersects the box.
More...
 
unsigned int IsOut (const Geom::Bnd_Box &Other) const
 Returns False if the <Box> intersects or is inside <me>.
More...
 
unsigned int IsOut (const Geom::Bnd_Box &Other, const Geom::Trsf &T) const
 
unsigned int IsOut (const Geom::Trsf &T1, const Geom::Bnd_Box &Other, const Geom::Trsf &T2) const
 
unsigned int IsOut (const Geom::Pnt &P1, const Geom::Pnt &P2, const Geom::Dir &D) const
 
Geom::Vec GetMinDifference (const Geom::Bnd_Box &Other) const
 Computes the minimum distance between two boxes.
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:

  • [ Xmin,Xmax ],
  • [ Ymin,Ymax ],
  • [ Zmin,Zmax ].
    A bounding box may be infinite (i.e. open) in one or more
    directions. It is said to be:
  • OpenXmin if it is infinite on the negative side of the "X Direction";
  • OpenXmax if it is infinite on the positive side of the "X Direction";
  • OpenYmin if it is infinite on the negative side of the "Y Direction";
  • OpenYmax if it is infinite on the positive side of the "Y Direction";
  • OpenZmin if it is infinite on the negative side of the "Z Direction";
  • OpenZmax if it is infinite on the positive side of the "Z Direction";
  • WholeSpace if it is infinite in all six directions. In this
    case, any point of the space is inside the box;
  • Void if it is empty. In this case, there is no point included in the box.
    A bounding box is defined by:
  • six bounds (Xmin, Xmax, Ymin, Ymax, Zmin and
    Zmax) which limit the bounding box if it is finite,
  • eight flags (OpenXmin, OpenXmax, OpenYmin,
    OpenYmax, OpenZmin, OpenZmax,
    WholeSpace and Void) which describe the
    bounding box if it is infinite or empty, and
  • a gap, which is included on both sides in any direction
    when consulting the finite bounds of the box.

Constructor & Destructor Documentation

◆ Bnd_Box() [1/2]

Geom::Bnd_Box::Bnd_Box ( )

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

◆ Bnd_Box() [2/2]

Geom::Bnd_Box::Bnd_Box ( const Geom::Pnt min,
const Geom::Pnt max 
)

Member Function Documentation

◆ Add() [1/4]

void Geom::Bnd_Box::Add ( const Bnd_Box Other)

Adds the box <Other> to <me>.

◆ Add() [2/4]

void Geom::Bnd_Box::Add ( const Geom::Pnt P)

Adds a Pnt to the box.

◆ Add() [3/4]

void Geom::Bnd_Box::Add ( const Geom::Pnt P,
const Geom::Dir D 
)

Extends <me> from the Pnt.

in the direction <D>.

◆ Add() [4/4]

void Geom::Bnd_Box::Add ( const Geom::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.

◆ Enlarge()

void Geom::Bnd_Box::Enlarge ( const double  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.

◆ Get()

void Geom::Bnd_Box::Get ( double &  aXmin,
double &  aYmin,
double &  aZmin,
double &  aXmax,
double &  aYmax,
double &  aZmax 
) 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().
if IsVoid()

◆ GetCenter()

const Geom::Pnt Geom::Bnd_Box::GetCenter ( ) const

Returns the center of this bounding box.
If this bounding box is infinite (i.e. "open"), returned value
may be equal to +/- Precision::Infinite().
if IsVoid()

◆ GetMax()

const Geom::Pnt Geom::Bnd_Box::GetMax ( ) const

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

◆ GetMin()

const Geom::Pnt Geom::Bnd_Box::GetMin ( ) const

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

◆ GetMinDifference()

Geom::Vec Geom::Bnd_Box::GetMinDifference ( const Geom::Bnd_Box Other) const

Computes the minimum distance between two boxes.

Computes the squared diagonal of me.

◆ GetSize()

void Geom::Bnd_Box::GetSize ( double &  length,
double &  width,
double &  height 
) const

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

◆ GetXmax()

const double Geom::Bnd_Box::GetXmax ( ) const

Returns the X max 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().
if IsVoid()

◆ GetXmin()

const double Geom::Bnd_Box::GetXmin ( ) const

Returns the X min 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().
if IsVoid()

◆ GetXsize()

const double Geom::Bnd_Box::GetXsize ( ) const

Returns the X size 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().
if IsVoid()

◆ GetYmax()

const double Geom::Bnd_Box::GetYmax ( ) const

Returns the Y max 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().
if IsVoid()

◆ GetYmin()

const double Geom::Bnd_Box::GetYmin ( ) const

Returns the Y min 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().
if IsVoid()

◆ GetYsize()

const double Geom::Bnd_Box::GetYsize ( ) const

Returns the Y size 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().
if IsVoid()

◆ GetZmax()

const double Geom::Bnd_Box::GetZmax ( ) const

Returns the Z max 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().
if IsVoid()

◆ GetZmin()

const double Geom::Bnd_Box::GetZmin ( ) const

Returns the Z min 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().
if IsVoid()

◆ GetZsize()

const double Geom::Bnd_Box::GetZsize ( ) const

Returns the Z size 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().
if IsVoid()

◆ IsOpenXmax()

unsigned int Geom::Bnd_Box::IsOpenXmax ( ) const

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

◆ IsOpenXmin()

unsigned int Geom::Bnd_Box::IsOpenXmin ( ) const

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

◆ IsOpenYmax()

unsigned int Geom::Bnd_Box::IsOpenYmax ( ) const

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

◆ IsOpenYmin()

unsigned int Geom::Bnd_Box::IsOpenYmin ( ) const

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

◆ IsOpenZmax()

unsigned int Geom::Bnd_Box::IsOpenZmax ( ) const

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

◆ IsOpenZmin()

unsigned int Geom::Bnd_Box::IsOpenZmin ( ) const

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

◆ IsOut() [1/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Pnt P) const

Returns True if the Pnt is out the box.

◆ IsOut() [2/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Lin L) const

Returns False if the line intersects the box.

◆ IsOut() [3/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Pln P) const

Returns False if the plane intersects the box.

◆ IsOut() [4/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Bnd_Box Other) const

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

◆ IsOut() [5/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Bnd_Box Other,
const Geom::Trsf T 
) const

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

◆ IsOut() [6/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Trsf T1,
const Geom::Bnd_Box Other,
const Geom::Trsf T2 
) const

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

◆ IsOut() [7/7]

unsigned int Geom::Bnd_Box::IsOut ( const Geom::Pnt P1,
const Geom::Pnt P2,
const Geom::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.

◆ IsVoid()

unsigned int Geom::Bnd_Box::IsVoid ( ) const

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

◆ IsWhole()

unsigned int Geom::Bnd_Box::IsWhole ( ) const

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

◆ OpenXmax()

void Geom::Bnd_Box::OpenXmax ( )

The Box will be infinitely long in the Xmax
direction.

◆ OpenXmin()

void Geom::Bnd_Box::OpenXmin ( )

The Box will be infinitely long in the Xmin
direction.

◆ OpenYmax()

void Geom::Bnd_Box::OpenYmax ( )

The Box will be infinitely long in the Ymax
direction.

◆ OpenYmin()

void Geom::Bnd_Box::OpenYmin ( )

The Box will be infinitely long in the Ymin
direction.

◆ OpenZmax()

void Geom::Bnd_Box::OpenZmax ( )

The Box will be infinitely long in the Zmax
direction.

◆ OpenZmin()

void Geom::Bnd_Box::OpenZmin ( )

The Box will be infinitely long in the Zmin
direction.

◆ Set() [1/2]

void Geom::Bnd_Box::Set ( const Geom::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 Geom::Bnd_Box::Set ( const Geom::Pnt P,
const Geom::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 Geom::Bnd_Box::SetGap ( const double  Tol)

Returns the gap of this bounding box.

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

◆ SetVoid()

void Geom::Bnd_Box::SetVoid ( )

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

◆ SetWhole()

void Geom::Bnd_Box::SetWhole ( )

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

◆ Transformed()

Geom::Bnd_Box Geom::Bnd_Box::Transformed ( const Geom::Trsf T) const

true if xmax-xmin < tol.

true if ymax-ymin < tol.
true if zmax-zmin < tol.
Returns true if IsXThin, IsYThin and IsZThin are all true,
i.e. if the box is thin in all three dimensions.
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 Geom::Bnd_Box::Update ( const double  aXmin,
const double  aYmin,
const double  aZmin,
const double  aXmax,
const double  aYmax,
const double  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 Geom::Bnd_Box::Update ( const double  X,
const double  Y,
const double  Z 
)

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


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