My Project
Public Member Functions | List of all members
ParaEngine::CShapeAABB Class Reference

AABB-related code. More...

#include <ShapeAABB.h>

Public Member Functions

 CShapeAABB (const CShapeBox &box)
 
 CShapeAABB (const Vector3 &center, const Vector3 &extents)
 
 CShapeAABB (const CShapeAABB *boxes, int nSize)
 
 CShapeAABB (const Vector3 *points, int nSize)
 
void SetMinMax (const Vector3 &min, const Vector3 &max)
 Setups an AABB from min & max vectors. More...
 
void SetCenterExtents (const Vector3 &c, const Vector3 &e)
 Setups an AABB from center & extents vectors. More...
 
void SetEmpty ()
 Setups an empty AABB.
 
void SetInvalid ()
 negative extents
 
void SetPointAABB (const Vector3 &pt)
 Setups a point AABB.
 
float GetSize () const
 Gets the size of the AABB. More...
 
Vector3 Point (int i) const
 get the i of the 8 corner points More...
 
void Extend (const Vector3 &p)
 Extends the AABB. More...
 
void Extend (const CShapeOBB &p)
 Extends the AABB. More...
 
void ExtendByPointList (const Vector3 *points, int nSize)
 Extends the AABB. More...
 
void ExtendByAABBList (const CShapeAABB *boxes, int nSize)
 Extends the AABB. More...
 
void GetMin (Vector3 &min) const
 Get min point of the box.
 
void GetMax (Vector3 &max) const
 Get max point of the box.
 
Vector3 GetMin () const
 Get min point of the box.
 
Vector3 GetMax () const
 Get max point of the box.
 
float GetMin (DWORD axis) const
 Get component of the box's min point along a given axis.
 
float GetMax (DWORD axis) const
 Get component of the box's max point along a given axis.
 
void GetCenter (Vector3 &center) const
 Get box center.
 
void GetExtents (Vector3 &extents) const
 Get box extents.
 
void SetCenter (const Vector3 &center)
 Get box center.
 
void SetExtents (const Vector3 &extents)
 Get box extents.
 
float GetCenter (DWORD axis) const
 Get component of the box's center along a given axis.
 
Vector3GetCenter ()
 
float GetExtents (DWORD axis) const
 Get component of the box's extents along a given axis.
 
Vector3GetExtents ()
 
void GetDiagonal (Vector3 &diagonal) const
 Get box diagonal.
 
float GetWidth () const
 
float GetHeight () const
 
float GetDepth () const
 
float GetRadius ()
 
void SetWidth (float fWidth)
 
void SetHeight (float fHeight)
 
void SetDepth (float fDepth)
 
float GetVolume () const
 Volume.
 
BOOL Intersect (const CShapeAABB &a) const
 Computes the intersection between two AABBs. More...
 
bool GomezIntersect (const CShapeAABB &a)
 The standard intersection method. More...
 
BOOL Intersect (const CShapeAABB &a, DWORD axis) const
 Computes the 1D-intersection between two CShapeAABBs, on a given axis. More...
 
bool Intersect (float *hitDist, const Vector3 *origPt, const Vector3 *dir, int *pHitSide=NULL)
 ray AABB intersection More...
 
bool IntersectOutside (float *hitDist, const Vector3 *origPt, const Vector3 *dir, int *pHitSide=NULL)
 ray AABB intersection More...
 
void Rotate (const Matrix4 &mtx, CShapeAABB &aabb) const
 Recomputes the CShapeAABB after an arbitrary transform by a 4x4 matrix. More...
 
BOOL IsValid () const
 Checks the CShapeAABB is valid. More...
 
CShapeAABBoperator*= (float s)
 Operator for CShapeAABB *= float. Scales the extents, keeps same center.
 
CShapeAABBoperator/= (float s)
 Operator for CShapeAABB /= float. Scales the extents, keeps same center.
 
CShapeAABBoperator+= (const Vector3 &trans)
 Operator for CShapeAABB += Vector3. Translates the box.
 

Detailed Description

AABB-related code.

(axis-aligned bounding box). Use CShapeBox, if one wants min, max box.

Member Function Documentation

§ Extend() [1/2]

void ParaEngine::CShapeAABB::Extend ( const Vector3 p)

Extends the AABB.

Parameters
p[in] the next point

§ Extend() [2/2]

void ParaEngine::CShapeAABB::Extend ( const CShapeOBB p)

Extends the AABB.

§ ExtendByAABBList()

void CShapeAABB::ExtendByAABBList ( const CShapeAABB boxes,
int  nSize 
)

Extends the AABB.

§ ExtendByPointList()

void CShapeAABB::ExtendByPointList ( const Vector3 points,
int  nSize 
)

Extends the AABB.

§ GetSize()

float CShapeAABB::GetSize ( ) const

Gets the size of the AABB.

The size is defined as the longest extent.

Returns
the size of the AABB

§ GomezIntersect()

bool CShapeAABB::GomezIntersect ( const CShapeAABB a)

The standard intersection method.

Just here to check its speed against the one above.

Parameters
a[in] the other CShapeAABB
Returns
true on intersection

§ Intersect() [1/3]

BOOL CShapeAABB::Intersect ( const CShapeAABB a) const

Computes the intersection between two AABBs.

Parameters
a[in] the other AABB
Returns
true on intersection

§ Intersect() [2/3]

BOOL CShapeAABB::Intersect ( const CShapeAABB a,
DWORD  axis 
) const

Computes the 1D-intersection between two CShapeAABBs, on a given axis.

Parameters
a[in] the other CShapeAABB
axis[in] the axis (0, 1, 2)
Returns
true on intersection

§ Intersect() [3/3]

bool CShapeAABB::Intersect ( float *  hitDist,
const Vector3 origPt,
const Vector3 dir,
int *  pHitSide = NULL 
)

ray AABB intersection

Parameters
pHitSide0 negativeX,1 positiveX,2 NZ,3 PZ,4 NY, 5PY
Returns
: true if ray is inside AABB

§ IntersectOutside()

bool ParaEngine::CShapeAABB::IntersectOutside ( float *  hitDist,
const Vector3 origPt,
const Vector3 dir,
int *  pHitSide = NULL 
)

ray AABB intersection

Parameters
pHitSide0 negativeX,1 positiveX,2 NZ,3 PZ,4 NY, 5PY
Returns
: always false if ray is inside AABB

§ IsValid()

BOOL CShapeAABB::IsValid ( ) const

Checks the CShapeAABB is valid.

Returns
true if the box is valid

§ Point()

Vector3 ParaEngine::CShapeAABB::Point ( int  i) const
inline

get the i of the 8 corner points

Parameters
i0-7

§ Rotate()

void CShapeAABB::Rotate ( const Matrix4 mtx,
CShapeAABB aabb 
) const

Recomputes the CShapeAABB after an arbitrary transform by a 4x4 matrix.

Parameters
mtx[in] the transform matrix
aabb[out] the transformed CShapeAABB [can be *this]

§ SetCenterExtents()

void ParaEngine::CShapeAABB::SetCenterExtents ( const Vector3 c,
const Vector3 e 
)
inline

Setups an AABB from center & extents vectors.

Parameters
c[in] the center point
e[in] the extents vector

§ SetMinMax()

void ParaEngine::CShapeAABB::SetMinMax ( const Vector3 min,
const Vector3 max 
)
inline

Setups an AABB from min & max vectors.

Parameters
min[in] the min point
max[in] the max point

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