Ocular Engine
Ocular::Math::BoundsOBB Class Reference

#include <BoundsOBB.hpp>

Inheritance diagram for Ocular::Math::BoundsOBB:
Ocular::Math::Bounds

Public Member Functions

 BoundsOBB (Vector3f const &center, Vector3f const &extents, Vector3f const &xDir, Vector3f const &yDir, Vector3f const &zDir)
 
Vector3f const & getCenter () const
 
void setCenter (Vector3f const &center)
 
Vector3f const & getExtents () const
 
void setExtents (Vector3f const &extents)
 
Vector3f const & getDirectionX () const
 
void setDirectionX (Vector3f const &dirX)
 
Vector3f const & getDirectionY () const
 
void setDirectionY (Vector3f const &dirY)
 
Vector3f const & getDirectionZ () const
 
void setDirectionZ (Vector3f const &dirZ)
 
bool intersects (Ray const &ray) const
 
bool intersects (BoundsSphere const &bounds) const
 
bool intersects (BoundsAABB const &bounds) const
 
bool intersects (BoundsOBB const &bounds) const
 
bool intersects (Plane const &plane, IntersectionType *result=nullptr) const
 
- Public Member Functions inherited from Ocular::Math::Bounds
BoundsType getType () const
 
bool isVisible () const
 
void setVisible (bool visible)
 

Additional Inherited Members

- Protected Member Functions inherited from Ocular::Math::Bounds
 Bounds (BoundsType const type)
 
- Protected Attributes inherited from Ocular::Math::Bounds
bool m_Visible
 
BoundsType m_Type
 

Detailed Description

Implementation of an Oriented Bounding Box.

Essentially an OBB is an AABB that can be arbitrarily rotated. They are more expensive to create and their intersection tests are more complicated, but have the benefit of not needing to be recalculated every time their contents are rotated.

Additionally, in most cases an OBB will also provide a tighter fit than an AABB.

Member Function Documentation

Vector3f const & Ocular::Math::BoundsOBB::getCenter ( ) const

Returns the center of the bounding box.

Vector3f const & Ocular::Math::BoundsOBB::getDirectionX ( ) const

Returns the normalized direction of the x-axis of the bounding box.

Vector3f const & Ocular::Math::BoundsOBB::getDirectionY ( ) const

Returns the normalized direction of the y-axis of the bounding box.

Vector3f const & Ocular::Math::BoundsOBB::getDirectionZ ( ) const

Returns the normalized direction of the z-axis of the bounding box.

Vector3f const & Ocular::Math::BoundsOBB::getExtents ( ) const

Returns the positive half-lengths of the box. These are the distances along each local axis to the box edge.

bool Ocular::Math::BoundsOBB::intersects ( Ray const &  ray) const

Performs an intersection test on a ray and OBB.

Parameters
[in]ray
Returns
TRUE if the ray and OBB intersect.
bool Ocular::Math::BoundsOBB::intersects ( BoundsSphere const &  bounds) const

Performs an intersection test on a bounding sphere and OBB.

Parameters
[in]bounds
Returns
TRUE if the bounding sphere and OBB intersect.
bool Ocular::Math::BoundsOBB::intersects ( BoundsAABB const &  bounds) const

Performs an intersection test on a AABB and OBB.

Parameters
[in]bounds
Returns
TRUE if the AABB and OBB intersect.
bool Ocular::Math::BoundsOBB::intersects ( BoundsOBB const &  bounds) const

Performs an intersection test on two OBBs.

Parameters
[in]bounds
Returns
TRUE if the two OBBs intersect.
bool Ocular::Math::BoundsOBB::intersects ( Plane const &  plane,
IntersectionType *  result = nullptr 
) const

Performs an intersection test on a plane and OBB.

If the result is Inside, then the OBB is located entirely within the plane's positive half space.
If the result is Outside, then the OBB is located entirely outside the plane's positive half space.

The positive half space of the plane is the direction that the plane is facing, as described by it's normal.

As an example, say we have the plane defined as:

 Point: (0.0, 0.0, 0.0)
Normal: (0.0, 1.0, 0.0)

The plane is 'facing up' along the world origin.

If the intersection test returns Outside, then the AABB is entirely in the +y world space.
If the intersection test returns Inside, then the AABB is entirely in the -y world space.

Parameters
[in]plane
[out]resultDetailed intersection result.
Returns
TRUE if the plane and OBB intersects, otherwise FALSE.
void Ocular::Math::BoundsOBB::setCenter ( Vector3f const &  center)

/param[in] center

void Ocular::Math::BoundsOBB::setDirectionX ( Vector3f const &  dirX)

/param[in] dirX

void Ocular::Math::BoundsOBB::setDirectionY ( Vector3f const &  dirY)

/param[in] dirY

void Ocular::Math::BoundsOBB::setDirectionZ ( Vector3f const &  dirZ)

/param[in] dirZ

void Ocular::Math::BoundsOBB::setExtents ( Vector3f const &  extents)

/param[in] extents


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