Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
CBoundingBoxAligned Class Reference

#include <BoundingBoxAligned.h>

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

Static Public Attributes

static const CBoundingBoxAligned EMPTY = CBoundingBoxAligned()
 

Private Attributes

CVector3D m_Data [2]
 

Detailed Description

Definition at line 35 of file BoundingBoxAligned.h.

Constructor & Destructor Documentation

CBoundingBoxAligned::CBoundingBoxAligned ( )
inline

Definition at line 39 of file BoundingBoxAligned.h.

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

Definition at line 40 of file BoundingBoxAligned.h.

Member Function Documentation

void CBoundingBoxAligned::Expand ( float  amount)

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

Definition at line 216 of file BoundingBoxAligned.cpp.

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

Definition at line 64 of file BoundingBoxAligned.h.

void CBoundingBoxAligned::GetCentre ( CVector3D centre) const
inline

Definition at line 109 of file BoundingBoxAligned.h.

float CBoundingBoxAligned::GetVolume ( ) const
inline

Definition at line 102 of file BoundingBoxAligned.h.

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

Definition at line 198 of file BoundingBoxAligned.cpp.

bool CBoundingBoxAligned::IsEmpty ( ) const

Definition at line 131 of file BoundingBoxAligned.cpp.

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

Definition at line 75 of file BoundingBoxAligned.h.

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

Definition at line 82 of file BoundingBoxAligned.h.

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

Definition at line 58 of file BoundingBoxAligned.h.

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

Definition at line 59 of file BoundingBoxAligned.h.

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.

Definition at line 42 of file BoundingBoxAligned.cpp.

void CBoundingBoxAligned::Render ( CShaderProgramPtr shader) const

Render: Render the surfaces of the bound object as triangles.

Definition at line 224 of file BoundingBoxAligned.cpp.

void CBoundingBoxAligned::RenderOutline ( CShaderProgramPtr shader) const

Render: Render the outline of the bound object as lines.

Definition at line 256 of file BoundingBoxAligned.cpp.

void CBoundingBoxAligned::SetEmpty ( )

Definition at line 123 of file BoundingBoxAligned.cpp.

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.

Definition at line 141 of file BoundingBoxAligned.cpp.

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.

Definition at line 166 of file BoundingBoxAligned.cpp.

Member Data Documentation

const CBoundingBoxAligned CBoundingBoxAligned::EMPTY = CBoundingBoxAligned()
static

Definition at line 150 of file BoundingBoxAligned.h.

CVector3D CBoundingBoxAligned::m_Data[2]
private

Definition at line 147 of file BoundingBoxAligned.h.


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