Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Mezzanine::AxisAlignedBox Class Reference

This is a utility class used to represent the Axis-Aligned Bounding Boxes of objects in various subsystems. More...

#include <axisalignedbox.h>

+ Collaboration diagram for Mezzanine::AxisAlignedBox:

Public Types

enum  AxisExtent { AE_Min = 1, AE_Max = 2 }
 This enum is used to help make querys for data on the AABB.
 
typedef std::pair< Boole, RayRayTestResult
 This is a type used for the return of a ray intersection test. More...
 
enum  Side {
  SideMinX = 0, SideMinY = 1, SideMinZ = 2, SideMaxX = 3,
  SideMaxY = 4, SideMaxZ = 5
}
 Used to uniquely identify sides of an axis aligned box.
 

Public Member Functions

 AxisAlignedBox ()
 Blank constructor.
 
 AxisAlignedBox (const AxisAlignedBox &Other)
 Copy constructor. More...
 
 AxisAlignedBox (const Vector3 &Min, const Vector3 &Max)
 Extents constructor. More...
 
 AxisAlignedBox (const Ogre::AxisAlignedBox &InternalAABB)
 Internal constructor. More...
 
 ~AxisAlignedBox ()
 Class destructor.
 
void Expand (const Vector3 &Point)
 Expands the size of this AABB to encompass it's current bounds plus a point in 3D space. More...
 
void Expand (const AxisAlignedBox &Other)
 Expands the size of this AABB to encompass it's current bounds plus another AABB. More...
 
void ExtractOgreAABB (const Ogre::AxisAlignedBox &InternalAABB)
 Changes this AxisAlignedBox to match the Ogre AxisAlignedBox. More...
 
Vector3 GetCenter () const
 Gets the center of this AABB. More...
 
Vector3 GetCorner (const AxisExtent XEx, const AxisExtent YEx, const AxisExtent ZEx) const
 Gets the location of the specified corner. More...
 
Vector3 GetHalfSize () const
 Gets half the size of this AABB. More...
 
Ogre::AxisAlignedBox GetOgreAABB () const
 Gets an Ogre::AxisAlignedBox that contains this Spheres information. More...
 
AxisAlignedBox GetOverlap (const AxisAlignedBox &Other) const
 Gets an AABB that has the dimensions of the overlap between this AABB and another AABB. More...
 
Real GetSideExtent (Side WhichSideExtent) const
 
Plane GetSidePlane (Side WhichSidePlane) const
 Get a plane corresponding to a side of the box. More...
 
Vector3 GetSize () const
 Gets the size of this AABB. More...
 
Real GetVolume () const
 Gets the total volume of this AABB. More...
 
RayTestResult Intersects (const Ray &ToCheck) const
 Checks to see if a ray intersects this AABB. More...
 
Boole IsInside (const Vector3 &ToCheck) const
 Checks to see if a point is inside this AABB. More...
 
Boole IsOverlapping (const Sphere &ToCheck) const
 Checks to see if a sphere overlaps with this AABB. More...
 
Boole IsOverlapping (const AxisAlignedBox &ToCheck) const
 Checks to see if another AABB overlaps with this one. More...
 
Boole IsOverlapping (const Plane &ToCheck) const
 Checks to see if a plane intersects this AABB. More...
 
Boole IsZero () const
 Gets whether or not this AABB has no size. More...
 
Boole operator!= (const AxisAlignedBox &Other) const
 Inequality operator. More...
 
Boole operator< (const AxisAlignedBox &Other) const
 Greater-than or equals-to operator. More...
 
Boole operator<= (const AxisAlignedBox &Other) const
 Less-than or equals-to operator. More...
 
void operator= (const AxisAlignedBox &Other)
 Assignment operator. More...
 
void operator= (const Ogre::AxisAlignedBox &InternalAABB)
 The assignment operator from Ogre::AxisAlignedBox to Mezzanine::AxisAlignedBox. More...
 
Boole operator== (const AxisAlignedBox &Other) const
 Equality operator. More...
 
Boole operator> (const AxisAlignedBox &Other) const
 Greater-than operator. More...
 
Boole operator>= (const AxisAlignedBox &Other) const
 Less-than operator. More...
 
void ProtoDeSerialize (const XML::Node &SelfRoot)
 Take the data stored in an XML Node and overwrite this object with it. More...
 
void ProtoSerialize (XML::Node &ParentNode) const
 Convert this class to an XML::Node ready for serialization. More...
 
void SetExtents (const Vector3 &Min, const Vector3 &Max)
 Sets the minimum and maximum extents of this AABB. More...
 

Static Public Member Functions

static String GetSerializableName ()
 Get the name of the the XML tag this class will leave behind as its instances are serialized. More...
 

Public Attributes

Vector3 MaxExt
 The maximum extents on each axis in world space. More...
 
Vector3 MinExt
 The minimum extents on each axis in world space. More...
 

Detailed Description

This is a utility class used to represent the Axis-Aligned Bounding Boxes of objects in various subsystems.

Definition at line 63 of file axisalignedbox.h.

Member Typedef Documentation

This is a type used for the return of a ray intersection test.

This type provides more verbose return data that can be used for further tests.

The first member stores whether or not there was a hit. The second member stores ray containing the points where the ray entered and exited the AABB.

Definition at line 76 of file axisalignedbox.h.

Constructor & Destructor Documentation

Mezzanine::AxisAlignedBox::AxisAlignedBox ( const AxisAlignedBox Other)

Copy constructor.

Parameters
OtherThe other AABB to copy.

Definition at line 62 of file axisalignedbox.cpp.

Mezzanine::AxisAlignedBox::AxisAlignedBox ( const Vector3 Min,
const Vector3 Max 
)

Extents constructor.

Parameters
MinThe minimum extents on each axis in world space.
MaxThe maximum extents on each axis in world space.

Definition at line 67 of file axisalignedbox.cpp.

Mezzanine::AxisAlignedBox::AxisAlignedBox ( const Ogre::AxisAlignedBox &  InternalAABB)
explicit

Internal constructor.

Parameters
InternalAABBThe internal Ogre AxisAlignedBox to construct this AxisAlignedBox from.

Definition at line 72 of file axisalignedbox.cpp.

Member Function Documentation

void Mezzanine::AxisAlignedBox::Expand ( const Vector3 Point)

Expands the size of this AABB to encompass it's current bounds plus a point in 3D space.

Parameters
PointThe point in 3D space to encompass.

Definition at line 107 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::Expand ( const AxisAlignedBox Other)

Expands the size of this AABB to encompass it's current bounds plus another AABB.

Parameters
OtherThe other AABB to encompass.

Definition at line 113 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::ExtractOgreAABB ( const Ogre::AxisAlignedBox &  InternalAABB)

Changes this AxisAlignedBox to match the Ogre AxisAlignedBox.

Parameters
InternalAABBThe Ogre::AxisAlignedBox to copy.

Definition at line 185 of file axisalignedbox.cpp.

Vector3 Mezzanine::AxisAlignedBox::GetCenter ( ) const

Gets the center of this AABB.

Returns
Returns a Vector3 containing the center of this AABB.

Definition at line 146 of file axisalignedbox.cpp.

Vector3 Mezzanine::AxisAlignedBox::GetCorner ( const AxisExtent  XEx,
const AxisExtent  YEx,
const AxisExtent  ZEx 
) const

Gets the location of the specified corner.

Parameters
XExThe extent for the X axis to retrieve.
YExThe extent for the Y axis to retrieve.
ZExThe extent for the Z axis to retrieve.
Returns
Returns a Vector3 representing the position of the specified corner.

Definition at line 149 of file axisalignedbox.cpp.

Vector3 Mezzanine::AxisAlignedBox::GetHalfSize ( ) const

Gets half the size of this AABB.

Returns
Returns a Vector3 representing half the size of this AABB.

Definition at line 143 of file axisalignedbox.cpp.

Ogre::AxisAlignedBox Mezzanine::AxisAlignedBox::GetOgreAABB ( ) const

Gets an Ogre::AxisAlignedBox that contains this Spheres information.

Returns
This returns an Ogre::AxisAlignedBox that contains the same information as this AxisAlignedBoxes information.

Definition at line 188 of file axisalignedbox.cpp.

AxisAlignedBox Mezzanine::AxisAlignedBox::GetOverlap ( const AxisAlignedBox Other) const

Gets an AABB that has the dimensions of the overlap between this AABB and another AABB.

Parameters
OtherThe AABB to get the overlap for.
Returns
Returns a new AABB containing the overlap between this and another AABB.

Definition at line 94 of file axisalignedbox.cpp.

String Mezzanine::AxisAlignedBox::GetSerializableName ( )
static

Get the name of the the XML tag this class will leave behind as its instances are serialized.

Returns
A string containing the name of this class.

Definition at line 232 of file axisalignedbox.cpp.

Plane Mezzanine::AxisAlignedBox::GetSidePlane ( AxisAlignedBox::Side  WhichSidePlane) const

Get a plane corresponding to a side of the box.

Parameters
WhichSidePlaneWhich side do you want a plane for?
Todo:
This plane stuff is farfrom optimal,

Definition at line 169 of file axisalignedbox.cpp.

Vector3 Mezzanine::AxisAlignedBox::GetSize ( ) const

Gets the size of this AABB.

Returns
Returns a Vector3 representing the size of this AABB.

Definition at line 140 of file axisalignedbox.cpp.

Real Mezzanine::AxisAlignedBox::GetVolume ( ) const

Gets the total volume of this AABB.

Returns
Returns the volume of this AABB expressed as cubic length units.

Definition at line 88 of file axisalignedbox.cpp.

AxisAlignedBox::RayTestResult Mezzanine::AxisAlignedBox::Intersects ( const Ray ToCheck) const

Checks to see if a ray intersects this AABB.

Parameters
ToCheckThe ray to check for a hit.
Returns
Returns a std::pair containing whether or not the ray hit, and if it did the subsection of the ray that went through the AABB.

Definition at line 131 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::IsInside ( const Vector3 ToCheck) const

Checks to see if a point is inside this AABB.

Parameters
ToCheckThe location to check to see if it is within this AABB.
Returns
Returns true if the point provided is within this AABB, false otherwise.

Definition at line 119 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::IsOverlapping ( const Sphere ToCheck) const

Checks to see if a sphere overlaps with this AABB.

Parameters
ToCheckThe sphere to check for overlap.
Returns
Returns true if the provided sphere overlaps with this AABB, false otherwise.

Definition at line 122 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::IsOverlapping ( const AxisAlignedBox ToCheck) const

Checks to see if another AABB overlaps with this one.

Parameters
ToCheckThe other AABB to check for overlap.
Returns
Returns true if the two AABB's overlap, false otherwise.

Definition at line 125 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::IsOverlapping ( const Plane ToCheck) const

Checks to see if a plane intersects this AABB.

Parameters
ToCheckThe plane to check for intersection.
Returns
Returns true if the provided plane intersects with this AABB, false otherwise.

Definition at line 128 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::IsZero ( ) const

Gets whether or not this AABB has no size.

Returns
Returns true if this AABB has no size/is invalid, false otherwise.

Definition at line 81 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator!= ( const AxisAlignedBox Other) const

Inequality operator.

Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is not the same as the other provided AABB, false otherwise.

Definition at line 261 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator< ( const AxisAlignedBox Other) const

Greater-than or equals-to operator.

Note
This operator compares the volume of both AABBs.
Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is larger than or equal to the other provided AABB, false otherwise.

Definition at line 249 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator<= ( const AxisAlignedBox Other) const

Less-than or equals-to operator.

Note
This operator compares the volume of both AABBs.
Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is smaller than or equal to the other provided AABB, false otherwise.

Definition at line 255 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::operator= ( const AxisAlignedBox Other)

Assignment operator.

Parameters
OtherThe other AABB to copy from.

Definition at line 240 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::operator= ( const Ogre::AxisAlignedBox &  InternalAABB)

The assignment operator from Ogre::AxisAlignedBox to Mezzanine::AxisAlignedBox.

Parameters
InternalAABBThe Ogre::AxisAlignedBox to take data from.

Definition at line 243 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator== ( const AxisAlignedBox Other) const

Equality operator.

Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is the same as the other provided AABB, false otherwise.

Definition at line 258 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator> ( const AxisAlignedBox Other) const

Greater-than operator.

Note
This operator compares the volume of both AABBs.
Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is larger than the other provided AABB, false otherwise.

Definition at line 246 of file axisalignedbox.cpp.

Boole Mezzanine::AxisAlignedBox::operator>= ( const AxisAlignedBox Other) const

Less-than operator.

Note
This operator compares the volume of both AABBs.
Parameters
OtherThe other AABB to compare with.
Returns
Returns true if this AABB is smaller than the other provided AABB, false otherwise.

Definition at line 252 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::ProtoDeSerialize ( const XML::Node SelfRoot)

Take the data stored in an XML Node and overwrite this object with it.

Parameters
SelfRootAn XML::Node containing the data to populate this class with.

Definition at line 212 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::ProtoSerialize ( XML::Node ParentNode) const

Convert this class to an XML::Node ready for serialization.

Parameters
ParentNodeThe point in the XML hierarchy that all this shape should be appended to.

Definition at line 194 of file axisalignedbox.cpp.

void Mezzanine::AxisAlignedBox::SetExtents ( const Vector3 Min,
const Vector3 Max 
)

Sets the minimum and maximum extents of this AABB.

Parameters
MinThe minimum extents on each axis in world space.
MaxThe maximum extents on each axis in world space.

Definition at line 137 of file axisalignedbox.cpp.

Member Data Documentation

Vector3 Mezzanine::AxisAlignedBox::MaxExt

The maximum extents on each axis in world space.

Definition at line 98 of file axisalignedbox.h.

Vector3 Mezzanine::AxisAlignedBox::MinExt

The minimum extents on each axis in world space.

Definition at line 95 of file axisalignedbox.h.


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