OpenLexocad  27.1
Base::BoundBox3< _Precision > Class Template Reference

#include <BoundBox.h>

Public Types

enum  OCTANT {
  OCT_LDB = 0, OCT_RDB, OCT_LUB, OCT_RUB,
  OCT_LDF, OCT_RDF, OCT_LUF, OCT_RUF
}
 
enum  SIDE {
  LEFT =0, RIGHT =1, TOP =2, BOTTOM =3,
  FRONT =4, BACK =5, INVALID =255
}
 
typedef _Precision num_type
 
typedef float_traits< num_typetraits_type
 

Public Member Functions

 BoundBox3 (_Precision fMinX=std::numeric_limits< _Precision >::max(), _Precision fMinY=std::numeric_limits< _Precision >::max(), _Precision fMinZ=std::numeric_limits< _Precision >::max(), _Precision fMaxX=-std::numeric_limits< _Precision >::max(), _Precision fMaxY=-std::numeric_limits< _Precision >::max(), _Precision fMaxZ=-std::numeric_limits< _Precision >::max())
 
 BoundBox3 (const BoundBox3< _Precision > &rcBB)
 
 BoundBox3 (const Vector3< _Precision > *pclVect, unsigned long ulCt)
 
 BoundBox3 (const Vector3< _Precision > &rcCnt, _Precision fDistance)
 
 ~BoundBox3 ()
 
BoundBox3< _Precision > & operator= (const BoundBox3< _Precision > &rcBound)
 Assignment operator. More...
 
bool GetOctantFromVector (const Vector3< _Precision > &rclVct, OCTANT &rclOctant) const
 
BoundBox3< _Precision > CalcOctant (typename BoundBox3< _Precision >::OCTANT Octant) const
 
Vector3< _Precision > CalcPoint (unsigned short usPoint) const
 
void CalcPlane (unsigned short usPlane, Vector3< _Precision > &rBase, Vector3< _Precision > &rNormal) const
 
bool CalcEdge (unsigned short usEdge, Vector3< _Precision > &rcP0, Vector3< _Precision > &rcP1) const
 
bool IntersectionPoint (const Vector3< _Precision > &rcVct, const Vector3< _Precision > &rcVctDir, Vector3< _Precision > &cVctRes, _Precision epsilon) const
 
bool IsCutLine (const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, _Precision fTolerance=0.0f) const
 
bool IsCutPlane (const Vector3< _Precision > &rclBase, const Vector3< _Precision > &rclNormal) const
 
bool IntersectWithLine (const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, Vector3< _Precision > &rcP0, Vector3< _Precision > &rcP1) const
 
bool IntersectPlaneWithLine (unsigned short usSide, const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, Vector3< _Precision > &rcP0) const
 
BoundBox3< _Precision >::SIDE GetSideFromRay (const Vector3< _Precision > &rclPt, const Vector3< _Precision > &rclDir) const
 
BoundBox3< _Precision >::SIDE GetSideFromRay (const Vector3< _Precision > &rclPt, const Vector3< _Precision > &rclDir, Vector3< _Precision > &rcInt) const
 
Vector3< _Precision > ClosestPoint (const Vector3< _Precision > &rclPt) const
 
BoundBox2d ProjectBox (const ViewProjMethod *rclP) const
 
BoundBox3< _Precision > Transformed (const Matrix4D &mat) const
 
Vector3< _Precision > GetCenter (void) const
 
_Precision CalcDiagonalLength (void) const
 
void SetVoid (void)
 
void Enlarge (_Precision fLen)
 
void Shrink (_Precision fLen)
 
_Precision LengthX (void) const
 
_Precision LengthY (void) const
 
_Precision LengthZ (void) const
 
void MoveX (_Precision f)
 
void MoveY (_Precision f)
 
void MoveZ (_Precision f)
 
void ScaleX (_Precision f)
 
void ScaleY (_Precision f)
 
void ScaleZ (_Precision f)
 
void Print (std::ostream &) const
 
bool Intersect (const BoundBox3< _Precision > &rcBB) const
 
bool operator && (const BoundBox3< _Precision > &rcBB) const
 
bool Intersect (const BoundBox2d &rcBB) const
 
bool operator && (const BoundBox2d &rcBB) const
 
BoundBox3< _Precision > Intersected (const BoundBox3< _Precision > &rcBB) const
 
BoundBox3< _Precision > United (const BoundBox3< _Precision > &rcBB) const
 
void Add (const Vector3< _Precision > &rclVect)
 
void Add (const BoundBox3< _Precision > &rcBB)
 
bool IsInBox (const Vector3< _Precision > &rcVct) const
 
bool IsInBox (const BoundBox3< _Precision > &rcBB) const
 
bool IsInBox (const BoundBox2d &rcbb) const
 
bool IsValid (void) const
 

Public Attributes

_Precision MinX
 
_Precision MinY
 
_Precision MinZ
 
_Precision MaxX
 
_Precision MaxY
 
_Precision MaxZ
 

Detailed Description

template<class _Precision>
class Base::BoundBox3< _Precision >

The 3D bounding box class.

Member Typedef Documentation

◆ num_type

template<class _Precision>
typedef _Precision Base::BoundBox3< _Precision >::num_type

◆ traits_type

template<class _Precision>
typedef float_traits<num_type> Base::BoundBox3< _Precision >::traits_type

Member Enumeration Documentation

◆ OCTANT

template<class _Precision>
enum Base::BoundBox3::OCTANT
Enumerator
OCT_LDB 
OCT_RDB 
OCT_LUB 
OCT_RUB 
OCT_LDF 
OCT_RDF 
OCT_LUF 
OCT_RUF 

◆ SIDE

template<class _Precision>
enum Base::BoundBox3::SIDE
Enumerator
LEFT 
RIGHT 
TOP 
BOTTOM 
FRONT 
BACK 
INVALID 

Constructor & Destructor Documentation

◆ BoundBox3() [1/4]

template<class _Precision >
Base::BoundBox3< _Precision >::BoundBox3 ( _Precision  fMinX = std::numeric_limits<_Precision>::max(),
_Precision  fMinY = std::numeric_limits<_Precision>::max(),
_Precision  fMinZ = std::numeric_limits<_Precision>::max(),
_Precision  fMaxX = -std::numeric_limits<_Precision>::max(),
_Precision  fMaxY = -std::numeric_limits<_Precision>::max(),
_Precision  fMaxZ = -std::numeric_limits<_Precision>::max() 
)
inlineexplicit

Builds box from pairs of x,y,z values.

◆ BoundBox3() [2/4]

template<class _Precision>
Base::BoundBox3< _Precision >::BoundBox3 ( const BoundBox3< _Precision > &  rcBB)
inline

◆ BoundBox3() [3/4]

template<class _Precision >
Base::BoundBox3< _Precision >::BoundBox3 ( const Vector3< _Precision > *  pclVect,
unsigned long  ulCt 
)
inline

Builds box from an array of points.

◆ BoundBox3() [4/4]

template<class _Precision >
Base::BoundBox3< _Precision >::BoundBox3 ( const Vector3< _Precision > &  rcCnt,
_Precision  fDistance 
)
inline

Defines a bounding box around the center rcCnt with the distances fDistance in each coordinate.

◆ ~BoundBox3()

template<class _Precision >
Base::BoundBox3< _Precision >::~BoundBox3 ( )
inline

Member Function Documentation

◆ Add() [1/2]

template<class _Precision >
void Base::BoundBox3< _Precision >::Add ( const Vector3< _Precision > &  rclVect)
inline

Appends the point to the box. The box can grow but not shrink.

◆ Add() [2/2]

template<class _Precision >
void Base::BoundBox3< _Precision >::Add ( const BoundBox3< _Precision > &  rcBB)
inline

Appends the bounding box to this box. The box can grow but not shrink.

◆ CalcDiagonalLength()

template<class _Precision >
_Precision Base::BoundBox3< _Precision >::CalcDiagonalLength ( void  ) const
inline

Compute the diagonal length of this bounding box.

Note
It's up to the client programmer to make sure that this bounding box is valid.

◆ CalcEdge()

template<class _Precision >
bool Base::BoundBox3< _Precision >::CalcEdge ( unsigned short  usEdge,
Vector3< _Precision > &  rcP0,
Vector3< _Precision > &  rcP1 
) const
inline

Calculates the two points of an edge. 0. edge P0-P1 1. edge P1-P2 2. edge P2-P3

  1. edge P3-P0 4. edge P4-P5 5. edge P5-P6
  2. edge P6-P7 7. edge P7-P4 8. edge P0-P4
  3. edge P1-P5 10. edge P2-P6 11. edge P3-P7

◆ CalcOctant()

template<class _Precision >
BoundBox3< _Precision > Base::BoundBox3< _Precision >::CalcOctant ( typename BoundBox3< _Precision >::OCTANT  Octant) const
inline

◆ CalcPlane()

template<class _Precision >
void Base::BoundBox3< _Precision >::CalcPlane ( unsigned short  usPlane,
Vector3< _Precision > &  rBase,
Vector3< _Precision > &  rNormal 
) const
inline

Returns the plane of the given side.

◆ CalcPoint()

template<class _Precision >
Vector3< _Precision > Base::BoundBox3< _Precision >::CalcPoint ( unsigned short  usPoint) const
inline

Returns the corner point usPoint. 0: front,bottom,left 1: front,bottom,right 2: front,top,right 3: front,top,left 4: back,bottom,left 5: back,bottom,right 6: back,top,right 7: back,top,left

◆ ClosestPoint()

template<class _Precision >
Vector3< _Precision > Base::BoundBox3< _Precision >::ClosestPoint ( const Vector3< _Precision > &  rclPt) const
inline

Searches for the closest point of the bounding box.

◆ Enlarge()

template<class _Precision >
void Base::BoundBox3< _Precision >::Enlarge ( _Precision  fLen)
inline

Enlarges the box with factor fLen.

◆ GetCenter()

template<class _Precision >
Vector3< _Precision > Base::BoundBox3< _Precision >::GetCenter ( void  ) const
inline

Returns the center.of the box.

◆ GetOctantFromVector()

template<class _Precision >
bool Base::BoundBox3< _Precision >::GetOctantFromVector ( const Vector3< _Precision > &  rclVct,
OCTANT rclOctant 
) const
inline

◆ GetSideFromRay() [1/2]

template<class _Precision >
BoundBox3< _Precision >::SIDE Base::BoundBox3< _Precision >::GetSideFromRay ( const Vector3< _Precision > &  rclPt,
const Vector3< _Precision > &  rclDir 
) const
inline

Returns the side of the bounding box the ray exits.

◆ GetSideFromRay() [2/2]

template<class _Precision >
BoundBox3< _Precision >::SIDE Base::BoundBox3< _Precision >::GetSideFromRay ( const Vector3< _Precision > &  rclPt,
const Vector3< _Precision > &  rclDir,
Vector3< _Precision > &  rcInt 
) const
inline

Returns the side of the bounding box the ray exits.

◆ Intersect() [1/2]

template<class _Precision >
bool Base::BoundBox3< _Precision >::Intersect ( const BoundBox3< _Precision > &  rcBB) const
inline

Methods for intersection, cutting and union of bounding boxes Checks for intersection.

◆ Intersect() [2/2]

template<class _Precision >
bool Base::BoundBox3< _Precision >::Intersect ( const BoundBox2d rcBB) const
inline

Checks for intersection.

◆ Intersected()

template<class _Precision >
BoundBox3< _Precision > Base::BoundBox3< _Precision >::Intersected ( const BoundBox3< _Precision > &  rcBB) const
inline

Computes the intersection between two bounding boxes. The result is also a bounding box.

◆ IntersectionPoint()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IntersectionPoint ( const Vector3< _Precision > &  rcVct,
const Vector3< _Precision > &  rcVctDir,
Vector3< _Precision > &  cVctRes,
_Precision  epsilon 
) const
inline

Intersection point of an inner search ray with the bounding box, built of the base rcVct and the direction rcVctDir. rcVct must lie inside the bounding box.

◆ IntersectPlaneWithLine()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IntersectPlaneWithLine ( unsigned short  usSide,
const Vector3< _Precision > &  rcBase,
const Vector3< _Precision > &  rcDir,
Vector3< _Precision > &  rcP0 
) const
inline

Computes the intersection point of line and a plane of the bounding box.

◆ IntersectWithLine()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IntersectWithLine ( const Vector3< _Precision > &  rcBase,
const Vector3< _Precision > &  rcDir,
Vector3< _Precision > &  rcP0,
Vector3< _Precision > &  rcP1 
) const
inline

Computes the intersection points of line and bounding box.

◆ IsCutLine()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsCutLine ( const Vector3< _Precision > &  rcBase,
const Vector3< _Precision > &  rcDir,
_Precision  fTolerance = 0.0f 
) const
inline

Checks for intersection with line incl. search tolerance.

◆ IsCutPlane()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsCutPlane ( const Vector3< _Precision > &  rclBase,
const Vector3< _Precision > &  rclNormal 
) const
inline

Checks if this plane specified by (point,normal) cuts this box.

Note
It's up to the client programmer to make sure that this bounding box is valid.

◆ IsInBox() [1/3]

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsInBox ( const Vector3< _Precision > &  rcVct) const
inline

Test methods Checks if this point lies inside the box.

Note
It's up to the client programmer to make sure that this bounding box is valid.

◆ IsInBox() [2/3]

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsInBox ( const BoundBox3< _Precision > &  rcBB) const
inline

Checks if this 3D box lies inside the box.

Note
It's up to the client programmer to make sure that both bounding boxes are valid.

◆ IsInBox() [3/3]

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsInBox ( const BoundBox2d rcbb) const
inline

Checks if this 2D box lies inside the box.

Note
It's up to the client programmer to make sure that both bounding boxes are valid.

◆ IsValid()

template<class _Precision >
bool Base::BoundBox3< _Precision >::IsValid ( void  ) const
inline

Checks whether the bounding box is valid.

◆ LengthX()

template<class _Precision >
_Precision Base::BoundBox3< _Precision >::LengthX ( void  ) const
inline

Calculates expansion in x-direction.

◆ LengthY()

template<class _Precision >
_Precision Base::BoundBox3< _Precision >::LengthY ( void  ) const
inline

Calculates expansion in y-direction.

◆ LengthZ()

template<class _Precision >
_Precision Base::BoundBox3< _Precision >::LengthZ ( void  ) const
inline

Calculates expansion in z-direction.

◆ MoveX()

template<class _Precision >
void Base::BoundBox3< _Precision >::MoveX ( _Precision  f)
inline

Moves in x-direction.

◆ MoveY()

template<class _Precision >
void Base::BoundBox3< _Precision >::MoveY ( _Precision  f)
inline

Moves in y-direction.

◆ MoveZ()

template<class _Precision >
void Base::BoundBox3< _Precision >::MoveZ ( _Precision  f)
inline

Moves in z-direction.

◆ operator &&() [1/2]

template<class _Precision >
bool Base::BoundBox3< _Precision >::operator && ( const BoundBox3< _Precision > &  rcBB) const
inline

Checks for intersection.

◆ operator &&() [2/2]

template<class _Precision >
bool Base::BoundBox3< _Precision >::operator && ( const BoundBox2d rcBB) const
inline

Checks for intersection.

◆ operator=()

template<class _Precision >
BoundBox3< _Precision > & Base::BoundBox3< _Precision >::operator= ( const BoundBox3< _Precision > &  rcBound)
inline

Assignment operator.

◆ Print()

template<class _Precision>
void Base::BoundBox3< _Precision >::Print ( std::ostream &  ) const

Prints the values to stream.

◆ ProjectBox()

template<class _Precision >
BoundBox2d Base::BoundBox3< _Precision >::ProjectBox ( const ViewProjMethod rclP) const
inline

Projects the box onto a plane and returns a 2D box.

◆ ScaleX()

template<class _Precision >
void Base::BoundBox3< _Precision >::ScaleX ( _Precision  f)
inline

Scales in x-direction.

◆ ScaleY()

template<class _Precision >
void Base::BoundBox3< _Precision >::ScaleY ( _Precision  f)
inline

Scales in y-direction.

◆ ScaleZ()

template<class _Precision >
void Base::BoundBox3< _Precision >::ScaleZ ( _Precision  f)
inline

Scales in z-direction.

◆ SetVoid()

template<class _Precision >
void Base::BoundBox3< _Precision >::SetVoid ( void  )
inline

◆ Shrink()

template<class _Precision >
void Base::BoundBox3< _Precision >::Shrink ( _Precision  fLen)
inline

Shrinks the box with factor fLen.

◆ Transformed()

template<class _Precision >
BoundBox3< _Precision > Base::BoundBox3< _Precision >::Transformed ( const Matrix4D mat) const
inline

Transform the corners of this box with the given matrix and create a new bounding box.

Note
It's up to the client programmer to make sure that this bounding box is valid.

◆ United()

template<class _Precision >
BoundBox3< _Precision > Base::BoundBox3< _Precision >::United ( const BoundBox3< _Precision > &  rcBB) const
inline

The union of two bounding boxes.

Member Data Documentation

◆ MaxX

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MaxX

◆ MaxY

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MaxY

◆ MaxZ

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MaxZ

◆ MinX

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MinX

Public attributes

◆ MinY

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MinY

◆ MinZ

template<class _Precision>
_Precision Base::BoundBox3< _Precision >::MinZ

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