14 CShapeAABB() : mCenter(0.f, 0.f, 0.f), mExtents(-1e33f, -1e33f, -1e33f){};
57 Vector3 Point(
int i)
const {
return Vector3( (i&1)?(mCenter.x-mExtents.x):(mCenter.x+mExtents.x), (i&2)?(mCenter.y-mExtents.y):(mCenter.y+mExtents.y), (i&4)?(mCenter.z-mExtents.z):(mCenter.z+mExtents.z)); }
87 float GetMin(DWORD axis)
const {
return mCenter[axis] - mExtents[axis]; }
89 float GetMax(DWORD axis)
const {
return mCenter[axis] + mExtents[axis]; }
102 float GetCenter(DWORD axis)
const {
return mCenter[axis]; }
105 float GetExtents(DWORD axis)
const {
return mExtents[axis]; }
110 float GetWidth()
const {
return mExtents.x * 2.0f; }
111 float GetHeight()
const {
return mExtents.y * 2.0f; }
112 float GetDepth()
const {
return mExtents.z * 2.0f; }
116 void SetWidth(
float fWidth);
117 void SetHeight(
float fHeight);
118 void SetDepth(
float fDepth);
121 float GetVolume()
const {
return mExtents.x * mExtents.y * mExtents.z * 8.0f; }
196 CShapeBox(): m_Min(1e33f, 1e33f, 1e33f), m_Max(-1e33f, -1e33f, -1e33f) { }
233 float GetWidth()
const {
return m_Max.x - m_Min.x; }
234 float GetHeight()
const {
return m_Max.y - m_Min.y; }
235 float GetDepth()
const {
return m_Max.z - m_Min.z; }
237 inline void GetCenter(
Vector3* vec)
const { *vec = 0.5f*(m_Min+m_Max); }
239 inline Vector3 GetCenter()
const {
return 0.5f*(m_Min+m_Max); }
240 inline Vector3 GetExtent()
const {
return 0.5f*(m_Max-m_Min); }
243 void Translate(
const Vector3& offset);
269 Vector3 Point(
int i)
const {
return Vector3( (i&1)?m_Min.x:m_Max.x, (i&2)?m_Min.y:m_Max.y, (i&4)?m_Min.z:m_Max.z ); }
const Vector3 & GetMin() const
Get min point of the box.
Definition: ShapeAABB.h:203
bool GomezIntersect(const CShapeAABB &a)
The standard intersection method.
Definition: ShapeAABB.cpp:58
void Rotate(const Matrix4 &mtx, CShapeAABB &aabb) const
Recomputes the CShapeAABB after an arbitrary transform by a 4x4 matrix.
Definition: ShapeAABB.cpp:80
float GetCenter(DWORD axis) const
Get component of the box's center along a given axis.
Definition: ShapeAABB.h:102
float GetMax(DWORD axis) const
Get component of the box's max point along a given axis.
Definition: ShapeAABB.h:89
void ExtendByAABBList(const CShapeAABB *boxes, int nSize)
Extends the AABB.
Definition: ShapeAABB.cpp:120
void SetExtents(const Vector3 &extents)
Get box extents.
Definition: ShapeAABB.h:99
different physics engine has different winding order.
Definition: EventBinding.h:32
void SetMinMax(const Vector3 &min, const Vector3 &max)
Setups an AABB from min & max vectors.
Definition: ShapeAABB.h:26
void SetMinMax(const Vector3 &min, const Vector3 &max)
Setups a box from min & max vectors.
Definition: ShapeAABB.h:212
float GetVolume() const
Volume.
Definition: ShapeAABB.h:121
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Vector3 GetMax() const
Get max point of the box.
Definition: ShapeAABB.h:84
void SetCenter(const Vector3 ¢er)
Get box center.
Definition: ShapeAABB.h:97
Vector3 GetMin() const
Get min point of the box.
Definition: ShapeAABB.h:82
void GetExtents(Vector3 &extents) const
Get box extents.
Definition: ShapeAABB.h:94
void GetDiagonal(Vector3 &diagonal) const
Get box diagonal.
Definition: ShapeAABB.h:109
void SetInvalid()
negative extents
Definition: ShapeAABB.cpp:115
Definition: ShapeSphere.h:6
AABB-related code.
Definition: ShapeAABB.h:11
float GetExtents(DWORD axis) const
Get component of the box's extents along a given axis.
Definition: ShapeAABB.h:105
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: ParaMatrix4.h:23
float GetSize() const
Gets the size of the AABB.
Definition: ShapeAABB.cpp:45
CShapeAABB & operator*=(float s)
Operator for CShapeAABB *= float. Scales the extents, keeps same center.
Definition: ShapeAABB.h:171
void GetMax(Vector3 &max) const
Get max point of the box.
Definition: ShapeAABB.h:79
void SetPointBox(const Vector3 &pt)
Setups a point box.
Definition: ShapeAABB.h:231
void GetMin(Vector3 &min) const
Get min point of the box.
Definition: ShapeAABB.h:77
BOOL IsValid() const
Checks the CShapeAABB is valid.
Definition: ShapeAABB.cpp:100
AABB with orientation by a matrix.
Definition: ShapeOBB.h:11
void ExtendByPointList(const Vector3 *points, int nSize)
Extends the AABB.
Definition: ShapeAABB.cpp:109
Vector3 Point(int i) const
get the i of the 8 corner points
Definition: ShapeAABB.h:57
void SetEmpty()
Setups an empty AABB.
Definition: ShapeAABB.cpp:74
void Extend(const Vector3 &p)
Extends the AABB.
Definition: ShapeAABB.cpp:132
void GetCenter(Vector3 ¢er) const
Get box center.
Definition: ShapeAABB.h:92
void SetPointAABB(const Vector3 &pt)
Setups a point AABB.
Definition: ShapeAABB.h:46
float GetMin(DWORD axis) const
Get component of the box's min point along a given axis.
Definition: ShapeAABB.h:87
void SetCenterExtents(const Vector3 &c, const Vector3 &e)
Setups an AABB from center & extents vectors.
Definition: ShapeAABB.h:33
CShapeAABB & operator/=(float s)
Operator for CShapeAABB /= float. Scales the extents, keeps same center.
Definition: ShapeAABB.h:174
CShapeAABB & operator+=(const Vector3 &trans)
Operator for CShapeAABB += Vector3. Translates the box.
Definition: ShapeAABB.h:177
bool IntersectOutside(float *hitDist, const Vector3 *origPt, const Vector3 *dir, int *pHitSide=NULL)
ray AABB intersection
Definition: ShapeAABB.cpp:176
a min max box.
Definition: ShapeAABB.h:190
const Vector3 & GetMax() const
Get max point of the box.
Definition: ShapeAABB.h:205
BOOL Intersect(const CShapeAABB &a) const
Computes the intersection between two AABBs.
Definition: ShapeAABB.cpp:50