PixelLightAPI  .
Public Types | Public Member Functions | Public Attributes
PLMath::AABoundingBox Class Reference

Axis align bounding box class. More...

#include <AABoundingBox.h>

List of all members.

Public Types

enum  Axis { X = 0, Y = 1, Z = 2 }
 Axis. More...

Public Member Functions

 AABoundingBox ()
 Default constructor setting all minimum and maximum components to 0.
 AABoundingBox (const AABoundingBox &cSource)
 Copy constructor.
 AABoundingBox (const Vector3 &vMinMax)
 Constructor.
 AABoundingBox (const Vector3 &vMin, const Vector3 &vMax)
 Constructor.
 AABoundingBox (float fMinX, float fMinY, float fMinZ, float fMaxX, float fMaxY, float fMaxZ)
 Constructor.
 ~AABoundingBox ()
 Destructor.
PLMATH_API AABoundingBoxoperator= (const AABoundingBox &cSource)
 Copy operator.
Vector3 GetCenter () const
 Returns the center of the box.
float GetWidth () const
 Returns the width.
float GetHeight () const
 Returns the height.
float GetDepth () const
 Returns the depth.
Axis GetLongestAxis () const
 Returns the longest axis.
float GetLongestAxisLength () const
 Returns the length of the longest axis.
float GetEnclosingRadius () const
 Returns the radius of a sphere placed at the origin (0, 0, 0) enclosing this axis align bounding box.
float GetInsideRadius () const
 Returns the radius of a sphere placed at the origin (0, 0, 0) inside this axis align bounding box.
float CalculateSurface () const
 Calculates the surface of the box.
float CalculateVolume () const
 Calculates the volume of the box.
void ClipByAABox (const AABoundingBox &cEnclosed)
 Clips this box with another one.
void AppendToCubicHull (const Vector3 &vV)
 Appends a vertex to the cubic hull.
void CombineAABoxes (const AABoundingBox &cBox)
 Combines two axis align boxes.
PLMATH_API void GetVertices (Vector3 vVertex[8]) const
 Returns the 8 corner vertices.
PLMATH_API Vector3 GetVertex (PLCore::uint32 nIndex) const
 Returns one of the 8 corner vertices.
PLMATH_API PLCore::uint32 GetNearestVertexIndex (const Vector3 &vClipPlaneNormal) const
 Calculates the index of the nearest vertex in the AAB according to the normal vector of a clip plane.
PLMATH_API PLCore::uint32 GetFurthestVertexIndex (const Vector3 &vClipPlaneNormal) const
 Calculates the index of the furthest vertex in the AAB according to the normal vector of a clip plane.
PLMATH_API void ValidateMinMax ()
 Ensures that the minimum is really the minimum and the maximum is really the maximum.
AABoundingBox operator+ (const Vector3 &vV) const
 Per component addition.
AABoundingBox operator+ (float fS) const
 Per component addition.
AABoundingBoxoperator+= (const Vector3 &vV)
 Per component addition.
AABoundingBoxoperator+= (float fS)
 Per component addition.
AABoundingBox operator- (const Vector3 &vV) const
 Per component subtraction.
AABoundingBox operator- (float fS) const
 Per component subtraction.
AABoundingBoxoperator-= (const Vector3 &vV)
 Per component subtraction.
AABoundingBoxoperator-= (float fS)
 Per component subtraction.
AABoundingBox operator* (const Vector3 &vV) const
 Per component multiplication.
AABoundingBox operator* (float fS) const
 Per component multiplication.
AABoundingBoxoperator*= (const Vector3 &vV)
 Per component multiplication.
AABoundingBoxoperator*= (float fS)
 Per component multiplication.
AABoundingBox operator/ (const Vector3 &vV) const
 Per component division.
AABoundingBox operator/ (float fS) const
 Per component division.
AABoundingBoxoperator/= (const Vector3 &vV)
 Per component division.
AABoundingBoxoperator/= (float fS)
 Per component division.

Public Attributes

Vector3 vMin
Vector3 vMax

Detailed Description

Axis align bounding box class.

Remarks:
        3+------+2  y
        /|     /|   |
       / |    / |   |
      / 0+---/--+1  *---x
    7+------+6 /   /
     | /    | /   z
     |/     |/
    4+------+5
Note:
  • It's highly recommended (but not enforced by this class) that the minimum is really the minimum and the maximum is really the maximum

Member Enumeration Documentation

Axis.

Enumerator:
X 

X axis

Y 

Y axis

Z 

Z axis


Constructor & Destructor Documentation

Default constructor setting all minimum and maximum components to 0.

PLMath::AABoundingBox::AABoundingBox ( const AABoundingBox cSource) [inline]

Copy constructor.

Parameters:
[in]cSourceSource to copy from
PLMath::AABoundingBox::AABoundingBox ( const Vector3 vMinMax) [inline]

Constructor.

Parameters:
[in]vMinMaxMinimum and maximum position
PLMath::AABoundingBox::AABoundingBox ( const Vector3 vMin,
const Vector3 vMax 
) [inline]

Constructor.

Parameters:
[in]vMinMinimum position
[in]vMaxMaximum position
PLMath::AABoundingBox::AABoundingBox ( float  fMinX,
float  fMinY,
float  fMinZ,
float  fMaxX,
float  fMaxY,
float  fMaxZ 
) [inline]

Constructor.

Parameters:
[in]fMinXX component of the minimum position
[in]fMinYY component of the minimum position
[in]fMinZZ component of the minimum position
[in]fMaxXX component of the maximum position
[in]fMaxYY component of the maximum position
[in]fMaxZZ component of the maximum position

Destructor.


Member Function Documentation

PLMATH_API AABoundingBox& PLMath::AABoundingBox::operator= ( const AABoundingBox cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this instance

Returns the center of the box.

Returns:
Center of the box ((vMax+vMin)/2)
float PLMath::AABoundingBox::GetWidth ( ) const [inline]

Returns the width.

Returns:
Width (vMax.x - vMin.x)
float PLMath::AABoundingBox::GetHeight ( ) const [inline]

Returns the height.

Returns:
Height (vMax.y - vMin.y)
float PLMath::AABoundingBox::GetDepth ( ) const [inline]

Returns the depth.

Returns:
Depth (vMax.z - vMin.z)

Returns the longest axis.

Returns:
The longest axis

Returns the length of the longest axis.

Returns:
The length of the longest axis

Returns the radius of a sphere placed at the origin (0, 0, 0) enclosing this axis align bounding box.

Returns:
The radius of a sphere placed at the origin (0, 0, 0) enclosing this axis align bounding box
float PLMath::AABoundingBox::GetInsideRadius ( ) const [inline]

Returns the radius of a sphere placed at the origin (0, 0, 0) inside this axis align bounding box.

Returns:
The radius of a sphere placed at the origin (0, 0, 0) inside this axis align bounding box
Note:
float PLMath::AABoundingBox::CalculateSurface ( ) const [inline]

Calculates the surface of the box.

Returns:
Surface of the box
float PLMath::AABoundingBox::CalculateVolume ( ) const [inline]

Calculates the volume of the box.

Returns:
Volume of the box
void PLMath::AABoundingBox::ClipByAABox ( const AABoundingBox cEnclosed) [inline]

Clips this box with another one.

Parameters:
[in]cEnclosedAxis align box to clip this box with
void PLMath::AABoundingBox::AppendToCubicHull ( const Vector3 vV) [inline]

Appends a vertex to the cubic hull.

Parameters:
[in]vVVertex to append
void PLMath::AABoundingBox::CombineAABoxes ( const AABoundingBox cBox) [inline]

Combines two axis align boxes.

Parameters:
[in]cBoxAxis align box to combine with this box
PLMATH_API void PLMath::AABoundingBox::GetVertices ( Vector3  vVertex[8]) const

Returns the 8 corner vertices.

Parameters:
[out]vVertexThis array will receive the 8 corner vertices
See also:
  • Remarks of this class for the positions of the 8 corner vertices
PLMATH_API Vector3 PLMath::AABoundingBox::GetVertex ( PLCore::uint32  nIndex) const

Returns one of the 8 corner vertices.

Parameters:
[in]nIndexIndex of the corner vertex to return
Returns:
The requested corner vertex
See also:
PLMATH_API PLCore::uint32 PLMath::AABoundingBox::GetNearestVertexIndex ( const Vector3 vClipPlaneNormal) const

Calculates the index of the nearest vertex in the AAB according to the normal vector of a clip plane.

Parameters:
[in]vClipPlaneNormalClip plane normal
Returns:
Index of the nearest vertex in the AAB according to the normal vector of a clip plane
PLMATH_API PLCore::uint32 PLMath::AABoundingBox::GetFurthestVertexIndex ( const Vector3 vClipPlaneNormal) const

Calculates the index of the furthest vertex in the AAB according to the normal vector of a clip plane.

Parameters:
[in]vClipPlaneNormalClip plane normal
Returns:
Index of the furthest vertex in the AAB according to the normal vector of a clip plane

Ensures that the minimum is really the minimum and the maximum is really the maximum.

AABoundingBox PLMath::AABoundingBox::operator+ ( const Vector3 vV) const [inline]

Per component addition.

Parameters:
[in]vVVector to add
Returns:
The resulting axis aligned bounding box
AABoundingBox PLMath::AABoundingBox::operator+ ( float  fS) const [inline]

Per component addition.

Parameters:
[in]fSScalar to add
Returns:
The resulting axis aligned bounding box
AABoundingBox & PLMath::AABoundingBox::operator+= ( const Vector3 vV) [inline]

Per component addition.

Parameters:
[in]vVVector to add
Returns:
Reference to this instance
AABoundingBox & PLMath::AABoundingBox::operator+= ( float  fS) [inline]

Per component addition.

Parameters:
[in]fSScalar to add
Returns:
Reference to this instance
AABoundingBox PLMath::AABoundingBox::operator- ( const Vector3 vV) const [inline]

Per component subtraction.

Parameters:
[in]vVVector to subtract
Returns:
The resulting axis aligned bounding box
AABoundingBox PLMath::AABoundingBox::operator- ( float  fS) const [inline]

Per component subtraction.

Parameters:
[in]fSScalar to subtract
Returns:
The resulting axis aligned bounding box
AABoundingBox & PLMath::AABoundingBox::operator-= ( const Vector3 vV) [inline]

Per component subtraction.

Parameters:
[in]vVVector to subtract
Returns:
Reference to this instance
AABoundingBox & PLMath::AABoundingBox::operator-= ( float  fS) [inline]

Per component subtraction.

Parameters:
[in]fSScalar to subtract
Returns:
Reference to this instance
AABoundingBox PLMath::AABoundingBox::operator* ( const Vector3 vV) const [inline]

Per component multiplication.

Parameters:
[in]vVVector to multiplicate with
Returns:
The resulting axis aligned bounding box
AABoundingBox PLMath::AABoundingBox::operator* ( float  fS) const [inline]

Per component multiplication.

Parameters:
[in]fSScalar to multiplicate with
Returns:
The resulting axis aligned bounding box
AABoundingBox & PLMath::AABoundingBox::operator*= ( const Vector3 vV) [inline]

Per component multiplication.

Parameters:
[in]vVVector to multiplicate with
Returns:
Reference to this instance
AABoundingBox & PLMath::AABoundingBox::operator*= ( float  fS) [inline]

Per component multiplication.

Parameters:
[in]fSScalar to multiplicate with
Returns:
Reference to this instance
AABoundingBox PLMath::AABoundingBox::operator/ ( const Vector3 vV) const [inline]

Per component division.

Parameters:
[in]vVVector to divide through
Returns:
The resulting axis aligned bounding box
AABoundingBox PLMath::AABoundingBox::operator/ ( float  fS) const [inline]

Per component division.

Parameters:
[in]fSScalar to divide through
Returns:
The resulting axis aligned bounding box
AABoundingBox & PLMath::AABoundingBox::operator/= ( const Vector3 vV) [inline]

Per component division.

Parameters:
[in]vVVector to divide through
Returns:
Reference to this instance
AABoundingBox & PLMath::AABoundingBox::operator/= ( float  fS) [inline]

Per component division.

Parameters:
[in]fSScalar to divide through
Returns:
Reference to this instance

Member Data Documentation

Minimum position

Maximum position


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


PixelLight PixelLight 0.9.10-R1
Copyright (C) 2002-2011 by The PixelLight Team
Last modified Fri Dec 23 2011 15:51:19
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported