Pyrogenesis  trunk
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
CBoundingBoxAligned Class Reference

#include <BoundingBoxAligned.h>

Collaboration diagram for CBoundingBoxAligned:
Collaboration graph
[legend]

Public Member Functions

 CBoundingBoxAligned ()
 
 CBoundingBoxAligned (const CVector3D &min, const CVector3D &max)
 
void Transform (const CMatrix3D &m, CBoundingBoxAligned &result) const
 Transforms these bounds according to the specified transformation matrix m, and writes the axis-aligned bounds of that result to result. More...
 
void Transform (const CMatrix3D &m, CBoundingBoxOriented &result) const
 Transform these bounds using the matrix transform, and write out the result as an oriented (i.e. More...
 
void Translate (const CVector3D &v, CBoundingBoxAligned &result) const
 Translates these bounds by v, and writes the result to result. More...
 
CVector3Doperator[] (int index)
 
const CVector3Doperator[] (int index) const
 
void SetEmpty ()
 
bool IsEmpty () const
 
void Extend (const CVector3D &min, const CVector3D &max)
 
CBoundingBoxAlignedoperator+= (const CBoundingBoxAligned &b)
 
CBoundingBoxAlignedoperator+= (const CVector3D &pt)
 
bool RayIntersect (const CVector3D &origin, const CVector3D &dir, float &tmin, float &tmax) const
 Check if a given ray intersects this AABB. More...
 
bool IsPointInside (const CVector3D &point) const
 
float GetVolume () const
 
void GetCenter (CVector3D &center) const
 
void Expand (float amount)
 Expand the bounding box by the given amount in every direction. More...
 
void IntersectFrustumConservative (const CFrustum &frustum)
 IntersectFrustumConservative: Approximate the intersection of this bounds object with the given frustum. More...
 
CFrustum ToFrustum () const
 Construct a CFrustum that describes the same volume as this bounding box. More...
 

Static Public Attributes

static const CBoundingBoxAligned EMPTY = CBoundingBoxAligned()
 

Private Attributes

CVector3D m_Data [2]
 

Constructor & Destructor Documentation

◆ CBoundingBoxAligned() [1/2]

CBoundingBoxAligned::CBoundingBoxAligned ( )
inline

◆ CBoundingBoxAligned() [2/2]

CBoundingBoxAligned::CBoundingBoxAligned ( const CVector3D min,
const CVector3D max 
)
inline

Member Function Documentation

◆ Expand()

void CBoundingBoxAligned::Expand ( float  amount)

Expand the bounding box by the given amount in every direction.

◆ Extend()

void CBoundingBoxAligned::Extend ( const CVector3D min,
const CVector3D max 
)
inline

◆ GetCenter()

void CBoundingBoxAligned::GetCenter ( CVector3D center) const
inline

◆ GetVolume()

float CBoundingBoxAligned::GetVolume ( ) const
inline

◆ IntersectFrustumConservative()

void CBoundingBoxAligned::IntersectFrustumConservative ( const CFrustum frustum)

IntersectFrustumConservative: Approximate the intersection of this bounds object with the given frustum.

The bounds object is overwritten with the results.

The approximation is conservative in the sense that the result will always contain the actual intersection, but it may be larger than the intersection itself. The result will always be fully contained within the original bounds.

Note
While not in the spirit of this function's purpose, a no-op would be a correct implementation of this function.
If this bound is empty, the result is the empty bound.
Parameters
frustumthe frustum to intersect with

◆ IsEmpty()

bool CBoundingBoxAligned::IsEmpty ( ) const

◆ IsPointInside()

bool CBoundingBoxAligned::IsPointInside ( const CVector3D point) const

◆ operator+=() [1/2]

CBoundingBoxAligned& CBoundingBoxAligned::operator+= ( const CBoundingBoxAligned b)
inline

◆ operator+=() [2/2]

CBoundingBoxAligned& CBoundingBoxAligned::operator+= ( const CVector3D pt)
inline

◆ operator[]() [1/2]

CVector3D& CBoundingBoxAligned::operator[] ( int  index)
inline

◆ operator[]() [2/2]

const CVector3D& CBoundingBoxAligned::operator[] ( int  index) const
inline

◆ RayIntersect()

bool CBoundingBoxAligned::RayIntersect ( const CVector3D origin,
const CVector3D dir,
float &  tmin,
float &  tmax 
) const

Check if a given ray intersects this AABB.

See also Real-Time Rendering, Third Edition by T. Akenine-Moller, p. 741–742.

Parameters
[in]originOrigin of the ray.
[in]dirDirection vector of the ray, defining the positive direction of the ray. Must be of unit length.
[out]tmin,tmaxdistance in the positive direction from the origin of the ray to the entry and exit points in the bounding box. If the origin is inside the box, then this is counted as an intersection and one of tMin and tMax may be negative.
Returns
true if the ray originating in origin and with unit direction vector dir intersects this AABB, false otherwise.

◆ SetEmpty()

void CBoundingBoxAligned::SetEmpty ( )

◆ ToFrustum()

CFrustum CBoundingBoxAligned::ToFrustum ( ) const

Construct a CFrustum that describes the same volume as this bounding box.

Only valid for non-empty bounding boxes - check IsEmpty() first.

◆ Transform() [1/2]

void CBoundingBoxAligned::Transform ( const CMatrix3D m,
CBoundingBoxAligned result 
) const

Transforms these bounds according to the specified transformation matrix m, and writes the axis-aligned bounds of that result to result.

◆ Transform() [2/2]

void CBoundingBoxAligned::Transform ( const CMatrix3D m,
CBoundingBoxOriented result 
) const

Transform these bounds using the matrix transform, and write out the result as an oriented (i.e.

non-axis-aligned) box. The difference with Transform(const CMatrix3D&, CBoundingBoxAligned&) is that that method is equivalent to first computing this result, and then taking the axis-aligned bounding boxes from the result again.

◆ Translate()

void CBoundingBoxAligned::Translate ( const CVector3D v,
CBoundingBoxAligned result 
) const
inline

Translates these bounds by v, and writes the result to result.

Member Data Documentation

◆ EMPTY

const CBoundingBoxAligned CBoundingBoxAligned::EMPTY = CBoundingBoxAligned()
static

◆ m_Data

CVector3D CBoundingBoxAligned::m_Data[2]
private

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