Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CollisionAABB Class Reference

#include <OPC_Common.h>

Public Member Functions

inline_ CollisionAABB ()
 Constructor. More...
 
inline_ CollisionAABB (const AABB &b)
 Constructor. More...
 
inline_ ~CollisionAABB ()
 Destructor. More...
 
inline_ void GetMin (Point &min) const
 Get min point of the box. More...
 
inline_ void GetMax (Point &max) const
 Get max point of the box. More...
 
inline_ float GetMin (udword axis) const
 Get component of the box's min point along a given axis. More...
 
inline_ float GetMax (udword axis) const
 Get component of the box's max point along a given axis. More...
 
inline_ void SetMinMax (const Point &min, const Point &max)
 
inline_ BOOL IsInside (const CollisionAABB &box) const
 

Public Attributes

Point mCenter
 Box center. More...
 
Point mExtents
 Box extents. More...
 

Detailed Description

An AABB dedicated to collision detection. We don't use the generic AABB class included in ICE, since it can be a Min/Max or a Center/Extents one (depends on compilation flags). Since the Center/Extents model is more efficient in collision detection, it was worth using an extra special class.

Author
Pierre Terdiman
Version
1.3
Date
March, 20, 2001

Definition at line 30 of file OPC_Common.h.

Constructor & Destructor Documentation

inline_ CollisionAABB::CollisionAABB ( )
inline

Constructor.

Definition at line 34 of file OPC_Common.h.

34 {}
inline_ CollisionAABB::CollisionAABB ( const AABB b)
inline

Constructor.

Definition at line 36 of file OPC_Common.h.

References AABB::GetCenter(), and AABB::GetExtents().

inline_ CollisionAABB::~CollisionAABB ( )
inline

Destructor.

Definition at line 38 of file OPC_Common.h.

38 {}

Member Function Documentation

inline_ void CollisionAABB::GetMax ( Point max) const
inline

Get max point of the box.

Definition at line 43 of file OPC_Common.h.

43 { max = mCenter + mExtents; }
inline_ float CollisionAABB::GetMax ( udword  axis) const
inline

Get component of the box's max point along a given axis.

Definition at line 48 of file OPC_Common.h.

48 { return mCenter[axis] + mExtents[axis]; }
inline_ void CollisionAABB::GetMin ( Point min) const
inline

Get min point of the box.

Definition at line 41 of file OPC_Common.h.

41 { min = mCenter - mExtents; }
inline_ float CollisionAABB::GetMin ( udword  axis) const
inline

Get component of the box's min point along a given axis.

Definition at line 46 of file OPC_Common.h.

46 { return mCenter[axis] - mExtents[axis]; }
inline_ BOOL CollisionAABB::IsInside ( const CollisionAABB box) const
inline

Checks a box is inside another box.

Parameters
box[in] the other box
Returns
true if current box is inside input box

Definition at line 66 of file OPC_Common.h.

67  {
68  if(box.GetMin(0)>GetMin(0)) return FALSE;
69  if(box.GetMin(1)>GetMin(1)) return FALSE;
70  if(box.GetMin(2)>GetMin(2)) return FALSE;
71  if(box.GetMax(0)<GetMax(0)) return FALSE;
72  if(box.GetMax(1)<GetMax(1)) return FALSE;
73  if(box.GetMax(2)<GetMax(2)) return FALSE;
74  return TRUE;
75  }
inline_ void CollisionAABB::SetMinMax ( const Point min,
const Point max 
)
inline

Setups an AABB from min & max vectors.

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

Definition at line 57 of file OPC_Common.h.

57 { mCenter = (max + min)*0.5f; mExtents = (max - min)*0.5f; }

Member Data Documentation

Point CollisionAABB::mCenter

Box center.

Definition at line 77 of file OPC_Common.h.

Referenced by AABBCollider::AABBAABBOverlap(), and AABBCollider::TriBoxOverlap().

Point CollisionAABB::mExtents

Box extents.

Definition at line 78 of file OPC_Common.h.

Referenced by AABBCollider::AABBAABBOverlap(), and AABBCollider::TriBoxOverlap().


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