OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Member Functions | List of all members
WBoundingBoxImpl< VT > Class Template Reference

Represents a axis parallel bounding box and provides some useful operations with them. More...

#include <WBoundingBox.h>

+ Inheritance diagram for WBoundingBoxImpl< VT >:
+ Collaboration diagram for WBoundingBoxImpl< VT >:

Public Types

typedef osg::BoundingBoxImpl< VT >::vec_type vec_type
 Vertex type for min and max positions of this box. More...
 
typedef osg::BoundingBoxImpl< VT >::value_type value_type
 Value type of the vertex type for example double, float, etc. More...
 

Public Member Functions

 WBoundingBoxImpl ()
 Default constructor. More...
 
 WBoundingBoxImpl (value_type xmin, value_type ymin, value_type zmin, value_type xmax, value_type ymax, value_type zmax)
 Wrapps the component wise bounding box constructor from osg::BoundingBox. More...
 
 WBoundingBoxImpl (const vec_type &min, const vec_type &max)
 Constructs a bounding box by min and max positions. More...
 
 WBoundingBoxImpl (const osg::BoundingSphereImpl< VT > &bs)
 Create BoundinmgBox using a given sphere. More...
 
virtual ~WBoundingBoxImpl ()
 Destructs this instance. More...
 
void reset ()
 Resets this box to an initial state where max is FLT_MIN and min FLT_MAX. More...
 
value_type radiusSquare () const
 Calculates and returns the squared length of the bounding box radius. More...
 
osg::BoundingBox toOSGBB () const
 Explicit type conversion function to use a WBoundingBox as osg::BoundingBox. More...
 
void expandBy (const WBoundingBoxImpl< VT > &bb)
 Expands this bounding box to include the given bounding box. More...
 
bool intersects (const WBoundingBoxImpl< VT > &bb) const
 Checks for intersection of this bounding box with the specified bounding box. More...
 
value_type minDistance (const WBoundingBoxImpl< VT > &bb) const
 Computes the minimal distance of tow axis parallel bounding boxes. More...
 
const vec_typegetMin () const
 Gives the front lower left aka minimum corner. More...
 
const vec_typegetMax () const
 Gives the back upper right aka maximum corner. More...
 

Private Member Functions

double intervalDistance (double a0, double a1, double b0, double b1) const
 Checks if the two given intervals intersect and computes the distance between them. More...
 

Detailed Description

template<class VT>
class WBoundingBoxImpl< VT >

Represents a axis parallel bounding box and provides some useful operations with them.

Note
Reason for subclassing: We don't want _min and _max member variables to be public.
Reason for not having a private osg::BoundingBox member is, we don't have to wrap many member functions and can make use of the using directive. A downside on this is, we cannot automatical cast to osg::BoundingBox even if we provide a cast operator! Hence when we need this we will provide a toOsgBB() member function.

Definition at line 47 of file WBoundingBox.h.

Member Typedef Documentation

◆ value_type

template<class VT >
typedef osg::BoundingBoxImpl< VT >::value_type WBoundingBoxImpl< VT >::value_type

Value type of the vertex type for example double, float, etc.

Definition at line 58 of file WBoundingBox.h.

◆ vec_type

template<class VT >
typedef osg::BoundingBoxImpl< VT >::vec_type WBoundingBoxImpl< VT >::vec_type

Vertex type for min and max positions of this box.

Definition at line 53 of file WBoundingBox.h.

Constructor & Destructor Documentation

◆ WBoundingBoxImpl() [1/4]

template<class VT >
WBoundingBoxImpl< VT >::WBoundingBoxImpl
inline

Default constructor.

Definition at line 192 of file WBoundingBox.h.

◆ WBoundingBoxImpl() [2/4]

template<class VT >
WBoundingBoxImpl< VT >::WBoundingBoxImpl ( value_type  xmin,
value_type  ymin,
value_type  zmin,
value_type  xmax,
value_type  ymax,
value_type  zmax 
)
inline

Wrapps the component wise bounding box constructor from osg::BoundingBox.

Parameters
xminMinimal x coordinate
yminMinimal y coordinate
zminMinimal z coordinate
xmaxMaximal x coordinate
ymaxMaximal y coordinate
zmaxMaximal z coordinate

Definition at line 198 of file WBoundingBox.h.

◆ WBoundingBoxImpl() [3/4]

template<class VT >
WBoundingBoxImpl< VT >::WBoundingBoxImpl ( const vec_type min,
const vec_type max 
)
inline

Constructs a bounding box by min and max positions.

Parameters
minPosition containing minx miny and minz coordinates.
maxPosition containing maxx maxy and maxz coordinates.

Definition at line 204 of file WBoundingBox.h.

◆ WBoundingBoxImpl() [4/4]

template<class VT >
WBoundingBoxImpl< VT >::WBoundingBoxImpl ( const osg::BoundingSphereImpl< VT > &  bs)
inlineexplicit

Create BoundinmgBox using a given sphere.

Parameters
bsthe sphere

Definition at line 210 of file WBoundingBox.h.

◆ ~WBoundingBoxImpl()

template<class VT >
WBoundingBoxImpl< VT >::~WBoundingBoxImpl
inlinevirtual

Destructs this instance.

Definition at line 217 of file WBoundingBox.h.

Member Function Documentation

◆ expandBy()

template<class VT >
void WBoundingBoxImpl< VT >::expandBy ( const WBoundingBoxImpl< VT > &  bb)
inline

◆ getMax()

template<class VT >
const WBoundingBoxImpl< VT >::vec_type & WBoundingBoxImpl< VT >::getMax
inline

◆ getMin()

template<class VT >
const WBoundingBoxImpl< VT >::vec_type & WBoundingBoxImpl< VT >::getMin
inline

◆ intersects()

template<class VT >
bool WBoundingBoxImpl< VT >::intersects ( const WBoundingBoxImpl< VT > &  bb) const
inline

Checks for intersection of this bounding box with the specified bounding box.

Parameters
bbThe other bouding box to tetst with.
Returns
True if they intersect, false otherwise.

Definition at line 246 of file WBoundingBox.h.

Referenced by WBoundingBoxTest::testForwardingFunctions().

+ Here is the caller graph for this function:

◆ intervalDistance()

template<class VT >
double WBoundingBoxImpl< VT >::intervalDistance ( double  a0,
double  a1,
double  b0,
double  b1 
) const
inlineprivate

Checks if the two given intervals intersect and computes the distance between them.

Parameters
a0lower bound of the first interval
a1upper bound of the first interval
b0lower bound of the second interval
b1upper bound if the second interval
Returns
The distance between those intervals if they don't overlap, zero otherwise

Definition at line 252 of file WBoundingBox.h.

◆ minDistance()

template<class VT >
WBoundingBoxImpl< VT >::value_type WBoundingBoxImpl< VT >::minDistance ( const WBoundingBoxImpl< VT > &  bb) const
inline

Computes the minimal distance of tow axis parallel bounding boxes.

Parameters
bbThe other bounding box.
Returns
Zero if they intersect, otherwise their minimal distance.

Definition at line 266 of file WBoundingBox.h.

Referenced by WBoundingBoxTest::testCommutativeIntervalDistance(), and WBoundingBoxTest::testMinimalDistanceBetweenTwoBB().

+ Here is the caller graph for this function:

◆ radiusSquare()

template<class VT >
WBoundingBoxImpl< VT >::value_type WBoundingBoxImpl< VT >::radiusSquare
inline

Calculates and returns the squared length of the bounding box radius.

Note
This is a wrapper call to osg::BoundingBoxImpl< VT >::radius2()
Returns
squared bbox radius

Definition at line 228 of file WBoundingBox.h.

◆ reset()

template<class VT >
void WBoundingBoxImpl< VT >::reset
inline

Resets this box to an initial state where max is FLT_MIN and min FLT_MAX.

Note
This is a wrapper call to osg::BoundingBoxImpl< VT >::init()

Definition at line 222 of file WBoundingBox.h.

Referenced by WBoundingBoxTest::testForwardingFunctions().

+ Here is the caller graph for this function:

◆ toOSGBB()

template<class VT >
osg::BoundingBox WBoundingBoxImpl< VT >::toOSGBB
inline

Explicit type conversion function to use a WBoundingBox as osg::BoundingBox.

Returns
A copy of this bounding box as osg::BoundingBox.

Definition at line 234 of file WBoundingBox.h.


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