Code_TYMPAN  4.2.0
Industrial site acoustic simulation
Public Member Functions | Public Attributes | List of all members
BBox Class Reference

Definition of a bounding box which is aligned along the axis (BBox AABB). More...

#include <BBox.h>

Public Member Functions

 BBox ()
 Default constructor. More...
 
 BBox (const vec3 &_pMin, const vec3 &_pMax)
 Constructor with initialization of the 3 points of the BBox. More...
 
 BBox (const BBox &other)
 Copy constructor. More...
 
vec3 getBBMin ()
 Return the lower point. More...
 
vec3 getBBMax ()
 Return the upper point. More...
 
vec3 getCentroid ()
 Return the center point. More...
 
void setBBMin (vec3 &_pMin)
 Set the lower point (center point is recomputed) More...
 
void setBBMax (vec3 &_pMax)
 Set the upper point (center point is recomputed) More...
 
double SurfaceArea () const
 Return the BBox area (sum of the lateral areas). Used for the SAH calculation of the accelerators. More...
 
BBox Union (const BBox &b, const vec3 &p)
 Union of a point and a BBox. A new BBox is created. More...
 
BBox Union (const vec3 &p)
 Union of a point and the current (this) BBox. A new BBox is created. More...
 
BBox Union (const BBox &b2)
 Union of a BBox and the current one. A new BBox is created. More...
 
BBox Union (const BBox &b1, const BBox &b2)
 Union of two BBox. A new BBox is created. More...
 
bool isInBox (const vec3 &p) const
 Check if a point is inside the BBox. More...
 
bool intersectBox (const BBox &box)
 Test the intersection of a BBox with this one. More...
 
int MaximumExtend () const
 Return the index of the dominant direction (maximal dimension). Index is 0 for x, 1 for y, 2 for z. More...
 
bool IntersectP (vec3 pos, vec3 dir, decimal *hitt0=NULL, decimal *hitt1=NULL) const
 Compute the intersection between a Ray and this BBox. More...
 
vec3 & operator[] (int i)
 Return the lower (0) or upper (1) point. More...
 
const vec3 & operator[] (int i) const
 Return the lower (0) or upper (1) point. More...
 
decimal diag ()
 Diagonal length of the BBox. More...
 
bool Inside (const vec3 &pt) const
 Return true if the point pt is inside the BBox. More...
 

Public Attributes

vec3 pMin
 Lower point of the BBox. More...
 
vec3 pMax
 Upper point of the BBox. More...
 
vec3 centroid
 Center point of the BBox. More...
 
bool isNull
 True if the BBox is initialized, false if not. More...
 

Detailed Description

Definition of a bounding box which is aligned along the axis (BBox AABB).

Definition at line 31 of file BBox.h.

Constructor & Destructor Documentation

◆ BBox() [1/3]

BBox::BBox ( )
inline

Default constructor.

Definition at line 44 of file BBox.h.

◆ BBox() [2/3]

BBox::BBox ( const vec3 &  _pMin,
const vec3 &  _pMax 
)
inline

Constructor with initialization of the 3 points of the BBox.

Parameters
_pMin: Definition of the lower point
_pMax: Definition of the upper point

Definition at line 51 of file BBox.h.

◆ BBox() [3/3]

BBox::BBox ( const BBox other)
inline

Copy constructor.

Definition at line 54 of file BBox.h.

Member Function Documentation

◆ diag()

decimal BBox::diag ( )
inline

Diagonal length of the BBox.

Definition at line 283 of file BBox.h.

◆ getBBMax()

vec3 BBox::getBBMax ( )
inline

Return the upper point.

Definition at line 60 of file BBox.h.

◆ getBBMin()

vec3 BBox::getBBMin ( )
inline

Return the lower point.

Definition at line 57 of file BBox.h.

◆ getCentroid()

vec3 BBox::getCentroid ( )
inline

Return the center point.

Definition at line 63 of file BBox.h.

◆ Inside()

bool BBox::Inside ( const vec3 &  pt) const
inline

Return true if the point pt is inside the BBox.

Definition at line 286 of file BBox.h.

Here is the caller graph for this function:

◆ intersectBox()

bool BBox::intersectBox ( const BBox box)
inline

Test the intersection of a BBox with this one.

Returns
Return true if they intersect. Also true if the BBox is included into the other.

Definition at line 179 of file BBox.h.

◆ IntersectP()

bool BBox::IntersectP ( vec3  pos,
vec3  dir,
decimal *  hitt0 = NULL,
decimal *  hitt1 = NULL 
) const
inline

Compute the intersection between a Ray and this BBox.

Parameters
pos[in] Ray position
dir[in] Ray direction
hitt0[out] Pointer to a float storing the t entering point of the ray from this BBox
hitt1[out] Pointer to a float storing the t leaving point of the ray from this BBox
Returns
Return true if the ray is in contact with this BBox

Definition at line 214 of file BBox.h.

Here is the caller graph for this function:

◆ isInBox()

bool BBox::isInBox ( const vec3 &  p) const
inline

Check if a point is inside the BBox.

Returns
Return true if the point is inside

Definition at line 169 of file BBox.h.

◆ MaximumExtend()

int BBox::MaximumExtend ( ) const
inline

Return the index of the dominant direction (maximal dimension). Index is 0 for x, 1 for y, 2 for z.

Definition at line 189 of file BBox.h.

Here is the caller graph for this function:

◆ operator[]() [1/2]

vec3& BBox::operator[] ( int  i)
inline

Return the lower (0) or upper (1) point.

Definition at line 270 of file BBox.h.

◆ operator[]() [2/2]

const vec3& BBox::operator[] ( int  i) const
inline

Return the lower (0) or upper (1) point.

Definition at line 276 of file BBox.h.

◆ setBBMax()

void BBox::setBBMax ( vec3 &  _pMax)
inline

Set the upper point (center point is recomputed)

Definition at line 69 of file BBox.h.

◆ setBBMin()

void BBox::setBBMin ( vec3 &  _pMin)
inline

Set the lower point (center point is recomputed)

Definition at line 66 of file BBox.h.

◆ SurfaceArea()

double BBox::SurfaceArea ( ) const
inline

Return the BBox area (sum of the lateral areas). Used for the SAH calculation of the accelerators.

Definition at line 72 of file BBox.h.

Here is the caller graph for this function:

◆ Union() [1/4]

BBox BBox::Union ( const BBox b,
const vec3 &  p 
)
inline

Union of a point and a BBox. A new BBox is created.

Parameters
b: Initial BBox (will be not modified)
p: Point to insert on the initial BBox
Returns
Return a new BBox

Definition at line 84 of file BBox.h.

Here is the caller graph for this function:

◆ Union() [2/4]

BBox BBox::Union ( const vec3 &  p)
inline

Union of a point and the current (this) BBox. A new BBox is created.

Parameters
p: Point to insert on the initial BBox
Returns
Return a new BBox

Definition at line 102 of file BBox.h.

◆ Union() [3/4]

BBox BBox::Union ( const BBox b2)
inline

Union of a BBox and the current one. A new BBox is created.

Parameters
b2: A BBox (will be not modified)
Returns
Return a new BBox

Definition at line 121 of file BBox.h.

◆ Union() [4/4]

BBox BBox::Union ( const BBox b1,
const BBox b2 
)
inline

Union of two BBox. A new BBox is created.

Parameters
b1: First BBox (will be not modified)
b2: Second BBox (will be not modified)
Returns
Return a new BBox

Definition at line 152 of file BBox.h.

Member Data Documentation

◆ centroid

vec3 BBox::centroid

Center point of the BBox.

Definition at line 38 of file BBox.h.

◆ isNull

bool BBox::isNull

True if the BBox is initialized, false if not.

Definition at line 39 of file BBox.h.

◆ pMax

vec3 BBox::pMax

Upper point of the BBox.

Definition at line 37 of file BBox.h.

◆ pMin

vec3 BBox::pMin

Lower point of the BBox.

Definition at line 36 of file BBox.h.


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