C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2
VSN::BoundingBox Class Reference

More...

#include <vsn_boundingbox.h>

+ Collaboration diagram for VSN::BoundingBox:

Public Member Functions

 BoundingBox ()
 The empty constructor.
 
 BoundingBox (const BoundingBox &init)
 Copy constructor.
 
 BoundingBox (const MbCube &init)
 Copy constructor.
 
 BoundingBox (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, bool normalize=false)
 The constructor by coordinates. More...
 
 BoundingBox (const Point3DF &p0, const Point3DF &p1, bool normalize=false)
 The constructor by two points. More...
 
 ~BoundingBox ()
 Destructor.
 
bool IsEmpty () const
 The check for emptiness. More...
 
void SetEmpty ()
 Set empty ("reverted").
 
void Set (float xmin, float ymin, float zmin, float xmax, float ymax, float zmax, bool normalize=false)
 Initialize by coordinates. More...
 
void Set (const Point3DF &p0, const Point3DF &p1, bool normalize=false)
 Initialize by two points. More...
 
Point3DF GetMin () const
 Give the minimal coordinates.
 
Point3DF GetMax () const
 Give the maximal coordinates.
 
void AddRect (const RectF &r, const Matrix3DF &placeFrom)
 Add bounding box. More...
 
void Normalize ()
 Normalize itself.
 
void Include (float x, float y, float z)
 Enclose a point specified as XYZ. More...
 
void Include (const Point3DF &)
 Enclose a point.
 
void Include (const BoundingBox &)
 Enclose a box.
 
bool Union (const BoundingBox &cube1, const BoundingBox &cube2)
 A box of union of two boxes. More...
 
float GetLengthX () const
 Give the size of the X side of a box.
 
float GetLengthY () const
 Give the size of the Y side of a box.
 
float GetLengthZ () const
 Give the size of the Z side of a box.
 
float GetDiagonal () const
 Give the size of box diagonal.
 
void GetVertex (size_t index, Point3DF &p) const
 Get a box vertex by an index. More...
 
Point3DF GetCenter () const
 Give the box center.
 
void Enlarge (float delta)
 Expand the box in all directions on a "delta" amount.
 
void Enlarge (float dx, float dy, float dz)
 Expand the box in all directions on a corresponding amount.
 
void Move (const Vector3DF &to)
 Translate along a vector.
 
void Transform (const Matrix3DF &matrix)
 Transform according to the matrix.
 
void Scale (float sx, float sy, float sz)
 Scale.
 
bool IsSame (const BoundingBox &other) const
 Determine whether an object is equal?
 
bool Intersect (const MbCartPoint3D &, const MbVector3D &, float eps) const
 Whether the box intersects the line or not. More...
 
void operator= (const BoundingBox &)
 Assign a value.
 
BoundingBoxoperator|= (const Point3DF &)
 Enclose a point.
 
BoundingBoxoperator|= (const BoundingBox &)
 Enclose a bounding box.
 
bool operator== (const BoundingBox &) const
 The equality operator.
 
bool operator!= (const BoundingBox &) const
 The inequality operator.
 

Detailed Description

.

Constructor & Destructor Documentation

◆ BoundingBox() [1/2]

VSN::BoundingBox::BoundingBox ( float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax,
bool  normalize = false 
)

The constructor by coordinates.

Parameters
[in]xmin,ymin,zmin- Coordinates of a box corner point with minimal coordinates.
[in]xmax,ymax,zmax- Coordinates of a box corner point with maximal coordinates.
[in]normalize- Normalize itself.

◆ BoundingBox() [2/2]

VSN::BoundingBox::BoundingBox ( const Point3DF p0,
const Point3DF p1,
bool  normalize = false 
)

The constructor by two points.

Parameters
[in]p0- A point of a box corner with minimal coordinates.
[in]p1- A point of a box corner with maximal coordinates.
[in]normalize- Normalize itself.

Member Function Documentation

◆ IsEmpty()

bool VSN::BoundingBox::IsEmpty ( ) const

The check for emptiness.

A bounding box is empty if it doesn't contain any points of 3D-space

◆ Set() [1/2]

void VSN::BoundingBox::Set ( float  xmin,
float  ymin,
float  zmin,
float  xmax,
float  ymax,
float  zmax,
bool  normalize = false 
)

Initialize by coordinates.

Parameters
[in]xmin,ymin,zmin- Coordinates of a box corner point with minimal coordinates.
[in]xmax,ymax,zmax- Coordinates of a box corner point with maximal coordinates.
[in]normalize- Normalize itself.

◆ Set() [2/2]

void VSN::BoundingBox::Set ( const Point3DF p0,
const Point3DF p1,
bool  normalize = false 
)

Initialize by two points.

Parameters
[in]p0- A point of a box corner with minimal coordinates.
[in]p1- A point of a box corner with maximal coordinates.
[in]normalize- Normalize itself.

◆ AddRect()

void VSN::BoundingBox::AddRect ( const RectF r,
const Matrix3DF placeFrom 
)

Add bounding box.

A bounding box is added in the local coordinate system of the initial box.

Parameters
[in]r- A bounding box.
[in]place- A local coordinate system.

◆ Include()

void VSN::BoundingBox::Include ( float  x,
float  y,
float  z 
)

Enclose a point specified as XYZ.

Parameters
[in]x,y,z- Coordinates of a point which has to be included in the box.

◆ Union()

bool VSN::BoundingBox::Union ( const BoundingBox cube1,
const BoundingBox cube2 
)

A box of union of two boxes.

Parameters
[in]cube1,cube2- Input boxes.
Returns
Returns false if the result box is empty,
true otherwise.

◆ GetVertex()

void VSN::BoundingBox::GetVertex ( size_t  index,
Point3DF p 
) const

Get a box vertex by an index.

Parameters
[in]index- An initial index. 0 <= index <= 7.
[out]p- Required vertex.

◆ Intersect()

bool VSN::BoundingBox::Intersect ( const MbCartPoint3D ,
const MbVector3D ,
float  eps 
) const

Whether the box intersects the line or not.

A line is given by a point and vector.

Parameters
[in]eps- A metric tolerance.
Returns
Returns true if it intersects.

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