Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | Related Pages

AABB Class Reference

#include <aabb.h>

Inheritance diagram for AABB:

Inheritance graph
[legend]
Collaboration diagram for AABB:

Collaboration graph
[legend]
List of all members.

Detailed Description

Axis-aligned bounding box.

Author:
Mattias Jansson (mattias@realityrift.com)
Todo:
When merging with other volumes, consider rotation to obtain real minimum volume


Public Types

enum  BOUNDINGVOLUMETYPE { BV_AABB, BV_OBB, BV_SPHERE, BV_CAPSULE }
 Bounding volume type identifiers. More...


Public Member Functions

 AABB (const Vector3d &rkDim=Vector3d::ZERO)
 AABB (const AABB &rkAABB)
virtual bool Intersection (BoundingVolume *pkObj, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (AABB *pkAABB, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (OBB *pkOBB, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (Sphere *pkSphere, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (Capsule *pkCapsule, ContactSet *pkContactSet=0, bool bInvertNormal=false)
virtual bool Intersection (Frustum *pkFrustum)
virtual bool Intersection (const Vector3d &rkV0, const Vector3d &rkV1, const Vector3d &rkV2, ContactSet *pkContactSet=0, bool bForceTriNormal=true, const Vector3d &rkNormal=Vector3d::ZERO)
virtual bool Intersection (const Vector3d &rkPoint)
virtual bool Intersection (const Ray &rkRay, ContactSet *pkContactSet=0)
virtual bool Intersection (const Line &rkLine)
virtual bool Intersection (const Plane &rkPlane)
virtual void Generate (AABB *pkAABB)
virtual void Generate (OBB *pkOBB)
virtual void Generate (Sphere *pkSphere)
virtual void Generate (Capsule *pkCapsule)
virtual void Generate (VertexBufferPtr &pkVertexBuffer)
virtual void Merge (AABB *pkAABB)
virtual void Merge (OBB *pkOBB)
virtual void Merge (Sphere *pkSphere)
virtual void Merge (Capsule *pkCapsule)
virtual void SetDim (const Vector3d &rkDim)
virtual void SetRotation (const Quaternion &rkRotation, bool bNotifyUpdate=true)
const Vector3dGetDim () const
const Vector3dGetRealDim () const
float GetRadius () const
virtual BOUNDINGVOLUMETYPE GetType ()
virtual BoundingVolumeDuplicate () const
virtual void RenderOutlines (const Color &rkColor=Color::GREEN) const
void Generate (BoundingVolume *pkObj)
void Merge (BoundingVolume *pkObj)
const Vector3dGetTranslation () const
const QuaternionGetRotation () const
float GetScaling () const
void Translate (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
void TranslateWorld (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
void Rotate (const Quaternion &rkRotation, bool bNotifyUpdate=true)
void RotateWorld (const Quaternion &rkRotation, bool bNotifyUpdate=true)
void Scale (float fScaling, bool bNotifyUpdate=true)
virtual void SetTranslation (const Vector3d &rkTranslation, bool bNotifyUpdate=true)
virtual void SetScaling (float fScaling, bool bNotifyUpdate=true)

Protected Member Functions

void RecalcDim ()

Protected Attributes

Vector3d m_kRealDim
Vector3d m_kDim
float m_fRadius
float m_fScaling
Quaternion m_kRotation
Vector3d m_kTranslation


Member Enumeration Documentation

enum BOUNDINGVOLUMETYPE [inherited]
 

Bounding volume type identifiers.

Enumeration values:
BV_AABB  Axis-aligned bounding box
BV_OBB  Oriented bounding box
BV_SPHERE  Sphere
BV_CAPSULE  Capsule


Constructor & Destructor Documentation

AABB const Vector3d rkDim = Vector3d::ZERO  ) 
 

Parameters:
rkDim Dimensions

AABB const AABB rkAABB  )  [inline]
 

Parameters:
rkAABB Reference object to copy


Member Function Documentation

void RecalcDim  )  [protected]
 

Recalculate dimensions

virtual bool Intersection BoundingVolume pkObj,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual]
 

Intersection test with unknown object type

Parameters:
pkObj Bounding volume object to test for intersection with
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if the objects intersect, false if not

Implements BoundingVolume.

virtual bool Intersection AABB pkAABB,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual]
 

Intersection with AABB

Parameters:
pkAABB AABB
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if the AABB intersect with this object, false if not

Implements BoundingVolume.

virtual bool Intersection OBB pkOBB,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual]
 

Intersection with OBB

Parameters:
pkOBB OBB
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if OBB intersect with this object, false if not

Implements BoundingVolume.

virtual bool Intersection Sphere pkSphere,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual]
 

Intersection with sphere

Parameters:
pkSphere Sphere
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if sphere intersect with this object, false if not

Implements BoundingVolume.

virtual bool Intersection Capsule pkCapsule,
ContactSet pkContactSet = 0,
bool  bInvertNormal = false
[inline, virtual]
 

Intersection with capsule

Parameters:
pkCapsule Capsule
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bInvertNormal If false, collision normal will point from passed object to this. If true, normal will point in other direction
Returns:
true if sphere intersect with this object, false if not

Implements BoundingVolume.

virtual bool Intersection Frustum pkFrustum  )  [inline, virtual]
 

Intersection with frustum

Parameters:
pkFrustum Frustum
Returns:
true if frustum intersects with this object, false if not

Implements BoundingVolume.

virtual bool Intersection const Vector3d rkV0,
const Vector3d rkV1,
const Vector3d rkV2,
ContactSet pkContactSet = 0,
bool  bForceTriNormal = true,
const Vector3d rkNormal = Vector3d::ZERO
[virtual]
 

Intersection with polygon

Parameters:
rkV0 First corner
rkV1 Second corner
rkV2 Third corner
pkContactSet Contact set object receiving collision contact data, 0 if not needed
bForceTriNormal If true force use of triangle normal as separating plane when calculating contact points and depths
rkNormal Optional precalculated normal
Returns:
true if polygon intersects with this object, false if not

Implements BoundingVolume.

virtual bool Intersection const Vector3d rkPoint  )  [virtual]
 

Intersection with point

Parameters:
rkPoint Point
Returns:
true if plane intersects with this object, false if not

Implements BoundingVolume.

virtual bool Intersection const Ray rkRay,
ContactSet pkContactSet = 0
[virtual]
 

Intersection with ray

Parameters:
rkRay Ray
pkContactSet Contact set object receiving collision contact data, 0 if not needed
Returns:
true if ray intersects with this object, false if not

Implements BoundingVolume.

virtual bool Intersection const Line rkLine  )  [virtual]
 

Intersection with line

Parameters:
rkLine Line
Returns:
true if line intersects with this object, false if not

Implements BoundingVolume.

virtual bool Intersection const Plane rkPlane  )  [virtual]
 

Intersection with plane

Parameters:
rkPlane Plane
Returns:
true if plane intersects with this object, false if not

Implements BoundingVolume.

virtual void Generate AABB pkAABB  )  [virtual]
 

Generate from AABB

Parameters:
pkAABB Source AABB object

Implements BoundingVolume.

virtual void Generate OBB pkOBB  )  [virtual]
 

Generate from OBB

Parameters:
pkOBB Source OBB object

Implements BoundingVolume.

virtual void Generate Sphere pkSphere  )  [virtual]
 

Generate from sphere

Parameters:
pkSphere Source sphere object

Implements BoundingVolume.

virtual void Generate Capsule pkCapsule  )  [virtual]
 

Generate from capsule

Parameters:
pkCapsule Source capsule object

Implements BoundingVolume.

virtual void Generate VertexBufferPtr pkVertexBuffer  )  [virtual]
 

Generate from vertex soup

Parameters:
pkVertexBuffer Vertex buffer

Implements BoundingVolume.

virtual void Merge AABB pkAABB  )  [virtual]
 

Merge with AABB

Parameters:
pkAABB Source AABB object

Implements BoundingVolume.

virtual void Merge OBB pkOBB  )  [virtual]
 

Merge with OBB

Parameters:
pkOBB Source OBB object

Implements BoundingVolume.

virtual void Merge Sphere pkSphere  )  [virtual]
 

Merge with sphere

Parameters:
pkSphere Source sphere object

Implements BoundingVolume.

virtual void Merge Capsule pkCapsule  )  [virtual]
 

Merge with capsule

Parameters:
pkCapsule Source capsule object

Implements BoundingVolume.

virtual void SetDim const Vector3d rkDim  )  [virtual]
 

Set dimensions of AABB in unrotated coordinate system

Parameters:
rkDim New dimensions

virtual void SetRotation const Quaternion rkRotation,
bool  bNotifyUpdate = true
[virtual]
 

Set rotation for AABB. We overload method to update the "real" dimension of the AABB

Parameters:
rkRotation New rotation for node
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

Reimplemented from SRTNode.

const Vector3d& GetDim  )  const [inline]
 

Returns:
Dimensions

const Vector3d& GetRealDim  )  const [inline]
 

Returns:
Unrotated dimensions

float GetRadius  )  const [inline]
 

Returns:
Radius of bounding sphere

virtual BOUNDINGVOLUMETYPE GetType  )  [inline, virtual]
 

Returns:
Bounding volume type identifier

Implements BoundingVolume.

virtual BoundingVolume* Duplicate  )  const [virtual]
 

Returns:
New AABB that is exact copy of this

Implements BoundingVolume.

virtual void RenderOutlines const Color rkColor = Color::GREEN  )  const [virtual]
 

Render volume outlines

Parameters:
rkColor Color of outlines

Implements BoundingVolume.

void Generate BoundingVolume pkObj  )  [inline, inherited]
 

Generate from unknown object

Parameters:
pkObj Source object

void Merge BoundingVolume pkObj  )  [inline, inherited]
 

Merge with unknown object

Parameters:
pkObj Source object

const Vector3d& GetTranslation  )  const [inline, inherited]
 

Returns:
Translation of this node

const Quaternion& GetRotation  )  const [inline, inherited]
 

Returns:
Rotation of this node

float GetScaling  )  const [inline, inherited]
 

Returns:
Uniform scaling factor

void Translate const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Translate node from current position, in local (along current rotated axes) coordinate system. Will call SetTranslation() for setting new translation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkTranslation Translation offset vector
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void TranslateWorld const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Translate node from current position, in world (along unrotated axes) coordinate system. Will call SetTranslation() for setting new translation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkTranslation Translation offset vector
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void Rotate const Quaternion rkRotation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Rotate node in local (current rotation) coordinate system. Will call SetRotation() for setting new rotation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkRotation Rotation quaternion
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void RotateWorld const Quaternion rkRotation,
bool  bNotifyUpdate = true
[inline, inherited]
 

Rotate node in world (unrotated) coordinate system. Will call SetRotation() for setting new rotation of node, derived classes do not need to overload this method directly. Not affected by current scaling.

Parameters:
rkRotation Rotation quaternion
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

void Scale float  fScaling,
bool  bNotifyUpdate = true
[inline, inherited]
 

Scale node by uniform factor. Will use SetScaling for setting new scaling of node, derived classes do not need to overload this method directly. Must be >0, where a value of 1.0f indicates no scaling

Parameters:
fScaling Uniform scaling factor
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

virtual void SetTranslation const Vector3d rkTranslation,
bool  bNotifyUpdate = true
[inline, virtual, inherited]
 

Set translation for node. Derived classes used in hierarchy trees can overload this method and implement caching of world data, or use flag to indicate update needed later.

Parameters:
rkTranslation New translation for node
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree

Reimplemented in HierarchyNode, HierarchyNode< Bone >, and HierarchyNode< SceneNode >.

virtual void SetScaling float  fScaling,
bool  bNotifyUpdate = true
[inline, virtual, inherited]
 

Set uniform scaling for node. Derived classes used in hierarchy trees can overload this method and implement caching of world data, or use flag to indicate update needed later. A value of 1.0f indicates no scaling.

Parameters:
fScaling New uniform scaling factor
bNotifyUpdate Used by derived classes to indicate if to set update flag to child tree (true default, use false with caution)

Reimplemented in HierarchyNode, HierarchyNode< Bone >, and HierarchyNode< SceneNode >.


Member Data Documentation

Vector3d m_kRealDim [protected]
 

Dimensions (calculated from real dim + rot)

Vector3d m_kDim [protected]
 

Real dimension

float m_fRadius [protected]
 

Length of dimension vector (bounding-sphere radius)

float m_fScaling [protected, inherited]
 

Uniform scaling factor (must be >0, default 1)

Quaternion m_kRotation [protected, inherited]
 

Rotation

Vector3d m_kTranslation [protected, inherited]
 

Translation


The documentation for this class was generated from the following file:
Generated on Wed Jan 21 14:21:10 2004 for NeoEngine by doxygen 1.3.5