Base::BoundBox3< _Precision > Class Template Reference

The 3D bounding box class. More...

#include <BoundBox.h>

Public Types

typedef _Precision num_type
 
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 float_traits< num_typetraits_type
 

Public Member Functions

void Add (const BoundBox3< _Precision > &rcBB)
 Appends the bounding box to this box. More...
 
void Add (const Vector3< _Precision > &rclVect)
 Appends the point to the box. More...
 
 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())
 Builds box from pairs of x,y,z values. More...
 
 BoundBox3 (const BoundBox3< _Precision > &rcBB)
 
 BoundBox3 (const Vector3< _Precision > &rcCnt, _Precision fDistance)
 Defines a bounding box around the center rcCnt with the distances fDistance in each coordinate. More...
 
 BoundBox3 (const Vector3< _Precision > *pclVect, unsigned long ulCt)
 Builds box from an array of points. More...
 
_Precision CalcDiagonalLength () const
 Compute the diagonal length of this bounding box. More...
 
bool CalcEdge (unsigned short usEdge, Vector3< _Precision > &rcP0, Vector3< _Precision > &rcP1) const
 Calculates the two points of an edge. More...
 
BoundBox3< _Precision > CalcOctant (typename BoundBox3< _Precision >::OCTANT Octant) const
 
void CalcPlane (unsigned short usPlane, Vector3< _Precision > &rBase, Vector3< _Precision > &rNormal) const
 Returns the plane of the given side. More...
 
Vector3< _Precision > CalcPoint (unsigned short usPoint) const
 Returns the corner point usPoint. More...
 
Vector3< _Precision > ClosestPoint (const Vector3< _Precision > &rclPt) const
 Searches for the closest point of the bounding box. More...
 
void Enlarge (_Precision fLen)
 Enlarges the box with factor fLen. More...
 
Vector3< _Precision > GetCenter () const
 Returns the center.of the box. More...
 
bool GetOctantFromVector (const Vector3< _Precision > &rclVct, OCTANT &rclOctant) const
 
BoundBox3< _Precision >::SIDE GetSideFromRay (const Vector3< _Precision > &rclPt, const Vector3< _Precision > &rclDir) const
 Returns the side of the bounding box the ray exits. More...
 
BoundBox3< _Precision >::SIDE GetSideFromRay (const Vector3< _Precision > &rclPt, const Vector3< _Precision > &rclDir, Vector3< _Precision > &rcInt) const
 Returns the side of the bounding box the ray exits. More...
 
bool Intersect (const BoundBox2d &rcBB) const
 Checks for intersection. More...
 
bool Intersect (const BoundBox3< _Precision > &rcBB) const
 Methods for intersection, cuttíng and union of bounding boxes. More...
 
BoundBox3< _Precision > Intersected (const BoundBox3< _Precision > &rcBB) const
 Computes the intersection between two bounding boxes. More...
 
bool IntersectionPoint (const Vector3< _Precision > &rcVct, const Vector3< _Precision > &rcVctDir, Vector3< _Precision > &cVctRes, _Precision epsilon) const
 Intersection point of an inner search ray with the bounding box, built of the base rcVct and the direction rcVctDir. More...
 
bool IntersectPlaneWithLine (unsigned short usSide, const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, Vector3< _Precision > &rcP0) const
 Computes the intersection point of line and a plane of the bounding box. More...
 
bool IntersectWithLine (const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, Vector3< _Precision > &rcP0, Vector3< _Precision > &rcP1) const
 Computes the intersection points of line and bounding box. More...
 
bool IsCutLine (const Vector3< _Precision > &rcBase, const Vector3< _Precision > &rcDir, _Precision fTolerance=0.0f) const
 Checks for intersection with line incl. More...
 
bool IsCutPlane (const Vector3< _Precision > &rclBase, const Vector3< _Precision > &rclNormal) const
 Checks if this plane specified by (point,normal) cuts this box. More...
 
bool IsInBox (const BoundBox2d &rcbb) const
 Checks if this 2D box lies inside the box. More...
 
bool IsInBox (const BoundBox3< _Precision > &rcBB) const
 Checks if this 3D box lies inside the box. More...
 
bool IsInBox (const Vector3< _Precision > &rcVct) const
 Test methods. More...
 
bool IsValid () const
 Checks whether the bounding box is valid. More...
 
_Precision LengthX () const
 Calculates expansion in x-direction. More...
 
_Precision LengthY () const
 Calculates expansion in y-direction. More...
 
_Precision LengthZ () const
 Calculates expansion in z-direction. More...
 
void MoveX (_Precision f)
 Moves in x-direction. More...
 
void MoveY (_Precision f)
 Moves in y-direction. More...
 
void MoveZ (_Precision f)
 Moves in z-direction. More...
 
bool operator&& (const BoundBox2d &rcBB) const
 Checks for intersection. More...
 
bool operator&& (const BoundBox3< _Precision > &rcBB) const
 Checks for intersection. More...
 
BoundBox3< _Precision > & operator= (const BoundBox3< _Precision > &rcBound)
 Assignment operator. More...
 
void Print (std::ostream &) const
 Prints the values to stream. More...
 
BoundBox2d ProjectBox (const ViewProjMethod *rclP) const
 Projects the box onto a plane and returns a 2D box. More...
 
void ScaleX (_Precision f)
 Scales in x-direction. More...
 
void ScaleY (_Precision f)
 Scales in y-direction. More...
 
void ScaleZ (_Precision f)
 Scales in z-direction. More...
 
void SetVoid ()
 
void Shrink (_Precision fLen)
 Shrinks the box with factor fLen. More...
 
BoundBox3< _Precision > Transformed (const Matrix4D &mat) const
 Transform the corners of this box with the given matrix and create a new bounding box. More...
 
BoundBox3< _Precision > United (const BoundBox3< _Precision > &rcBB) const
 The union of two bounding boxes. More...
 
 ~BoundBox3 ()
 

Public Attributes

_Precision MaxX
 
_Precision MaxY
 
_Precision MaxZ
 
_Precision MinX
 Public attributes. More...
 
_Precision MinY
 
_Precision MinZ
 

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() 
)
explicit

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

◆ BoundBox3() [2/4]

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

◆ BoundBox3() [3/4]

◆ BoundBox3() [4/4]

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

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

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ ~BoundBox3()

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

Member Function Documentation

◆ Add() [1/2]

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

◆ Add() [2/2]

◆ CalcDiagonalLength()

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

◆ CalcEdge()

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

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

◆ CalcPlane()

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

Returns the plane of the given side.

References Base::Vector3< _Precision >::Set().

◆ CalcPoint()

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

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

Referenced by MeshCore::MeshTrimByPlane::CheckFacets(), Mesh::MeshObject::createCube(), and Mesh::MeshObject::getBoundBox().

◆ ClosestPoint()

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

Searches for the closest point of the bounding box.

References DraftVecUtils::closest(), and Base::Vector3< _Precision >::ProjectToPlane().

◆ Enlarge()

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

◆ GetCenter()

◆ GetOctantFromVector()

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

◆ GetSideFromRay() [1/2]

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

◆ 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

Returns the side of the bounding box the ray exits.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ Intersect() [1/2]

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

◆ Intersect() [2/2]

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

◆ Intersected()

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

◆ IntersectionPoint()

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

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.

References Base::BoundBox3< _Precision >::Enlarge(), draftutils.utils::epsilon(), and Base::BoundBox3< _Precision >::IsInBox().

◆ IntersectPlaneWithLine()

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

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

References Base::Vector3< _Precision >::Scale().

◆ IntersectWithLine()

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

Computes the intersection points of line and bounding box.

References Base::Vector3< _Precision >::x, Base::Vector3< _Precision >::y, and Base::Vector3< _Precision >::z.

◆ IsCutLine()

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

◆ IsCutPlane()

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

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.

Referenced by MeshCore::MeshProjection::bboxInsideRectangle(), MeshCore::MeshTrimByPlane::CheckFacets(), MeshCore::MeshAlgorithm::CutWithPlane(), and MeshCore::MeshAlgorithm::GetFacetsFromPlane().

◆ IsInBox() [1/3]

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

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.

References Base::BoundBox2d::MaxX, Base::BoundBox2d::MaxY, Base::BoundBox2d::MinX, and Base::BoundBox2d::MinY.

◆ IsInBox() [2/3]

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

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.

References Base::BoundBox3< _Precision >::MaxX, Base::BoundBox3< _Precision >::MaxY, Base::BoundBox3< _Precision >::MaxZ, Base::BoundBox3< _Precision >::MinX, Base::BoundBox3< _Precision >::MinY, and Base::BoundBox3< _Precision >::MinZ.

◆ IsInBox() [3/3]

◆ IsValid()

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

◆ LengthX()

◆ LengthY()

◆ LengthZ()

◆ MoveX()

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

Moves in x-direction.

Referenced by TechDraw::DrawProjGroup::getBoundingBox().

◆ MoveY()

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

Moves in y-direction.

Referenced by TechDraw::DrawProjGroup::getBoundingBox().

◆ MoveZ()

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

Moves in z-direction.

◆ operator&&() [1/2]

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

Checks for intersection.

◆ operator&&() [2/2]

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

Checks for intersection.

◆ 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

◆ ScaleX()

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

◆ ScaleY()

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

◆ ScaleZ()

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

◆ SetVoid()

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

◆ Shrink()

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

Shrinks the box with factor fLen.

◆ Transformed()

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

◆ United()

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

Member Data Documentation

◆ MaxX

◆ MaxY

◆ MaxZ

◆ MinX

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

◆ MinY

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

◆ MinZ


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