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...
 
float GetVolume () const
 
void GetCentre (CVector3D &centre) 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...
 
void Render (CShaderProgramPtr &shader) const
 Render the surfaces of the bound object as triangles. More...
 
void RenderOutline (CShaderProgramPtr &shader) const
 Render the outline of the bound object as lines. More...
 

Static Public Attributes

static const CBoundingBoxAligned EMPTY = CBoundingBoxAligned()
 

Private Attributes

CVector3D m_Data [2]
 

Constructor & Destructor Documentation

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

Member Function Documentation

void CBoundingBoxAligned::Expand ( float  amount)

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

void CBoundingBoxAligned::Extend ( const CVector3D min,
const CVector3D max 
)
inline
void CBoundingBoxAligned::GetCentre ( CVector3D centre) const
inline
float CBoundingBoxAligned::GetVolume ( ) const
inline
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
bool CBoundingBoxAligned::IsEmpty ( ) const
CBoundingBoxAligned& CBoundingBoxAligned::operator+= ( const CBoundingBoxAligned b)
inline
CBoundingBoxAligned& CBoundingBoxAligned::operator+= ( const CVector3D pt)
inline
CVector3D& CBoundingBoxAligned::operator[] ( int  index)
inline
const CVector3D& CBoundingBoxAligned::operator[] ( int  index) const
inline
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.
void CBoundingBoxAligned::Render ( CShaderProgramPtr shader) const

Render the surfaces of the bound object as triangles.

void CBoundingBoxAligned::RenderOutline ( CShaderProgramPtr shader) const

Render the outline of the bound object as lines.

void CBoundingBoxAligned::SetEmpty ( )
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.

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.

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.

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

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

Member Data Documentation

const CBoundingBoxAligned CBoundingBoxAligned::EMPTY = CBoundingBoxAligned()
static
CVector3D CBoundingBoxAligned::m_Data[2]
private

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