Ocular Engine
|
Public Member Functions | |
BoundsSphere (std::list< Point3f > const &points, Math::Matrix4x4 const &matrix=Math::Matrix4x4()) | |
BoundsSphere (std::vector< Graphics::Vertex > const &vertices, Math::Matrix4x4 const &matrix=Math::Matrix4x4()) | |
BoundsSphere (Vector3f const ¢er, float radius) | |
void | construct (std::list< Vector3f > const &points, Math::Matrix4x4 const &matrix=Math::Matrix4x4()) |
void | construct (std::vector< Graphics::Vertex > const &vertices, Math::Matrix4x4 const &matrix=Math::Matrix4x4()) |
void | setCenter (Vector3f const ¢er) |
void | setRadius (float radius) |
Vector3f const & | getCenter () const |
float | getRadius () const |
void | expand (float const amount) |
void | expandToContain (Vector3f const &point) |
void | expandToContain (BoundsSphere const &other) |
bool | intersects (Ray const &ray) const |
bool | intersects (Ray const &ray, Vector3f &point, float &distance) 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 |
bool | contains (Vector3f const &point, IntersectionType *result=nullptr) const |
bool | contains (BoundsSphere const &sphere, 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 |
void Ocular::Math::BoundsSphere::construct | ( | std::list< Vector3f > const & | points, |
Math::Matrix4x4 const & | matrix = Math::Matrix4x4() |
||
) |
Constructs the bounds from a collection of spatial points.
[in] | points |
bool Ocular::Math::BoundsSphere::contains | ( | Vector3f const & | point, |
IntersectionType * | result = nullptr |
||
) | const |
Calculates if the bounds contains the specified point.
[in] | point | |
[out] | result | The exact result of the containment test (intersection, outside, inside). |
bool Ocular::Math::BoundsSphere::contains | ( | BoundsSphere const & | sphere, |
IntersectionType * | result = nullptr |
||
) | const |
Calculates if any portion of the specified bounding sphere is contained within the spere.
[in] | sphere | |
[out] | result | The exact result of the containment test (intersection, outside, inside). |
void Ocular::Math::BoundsSphere::expand | ( | float const | amount | ) |
Expands the radius of the bounding sphere by the specified amount.
[in] | amount |
void Ocular::Math::BoundsSphere::expandToContain | ( | Vector3f const & | point | ) |
Expands the bounding sphere so that it contains the specified point. If the point is already in the sphere then no action is taken.
[in] | point |
void Ocular::Math::BoundsSphere::expandToContain | ( | BoundsSphere const & | other | ) |
Expands the bounding sphere so that it contains the second bounding sphere. If the second sphere is already contained then no action is taken.
[in] | other |
Vector3f const & Ocular::Math::BoundsSphere::getCenter | ( | ) | const |
Returns the center of the bounding sphere.
float Ocular::Math::BoundsSphere::getRadius | ( | ) | const |
Returns the radius of the bounding sphere.
bool Ocular::Math::BoundsSphere::intersects | ( | Ray const & | ray | ) | const |
Performs an intersection test on a ray and bounding sphere.
[in] | ray |
bool Ocular::Math::BoundsSphere::intersects | ( | Ray const & | ray, |
Vector3f & | point, | ||
float & | distance | ||
) | const |
Performs an intersection test on a ray and bounding sphere.
This version of the method also returns the point at which the two intersect. If speed is of the uptmost concern and/or the exact point of intersection is not required, then the other version may be used instead.
[in] | ray | |
[out] | point | The point that the ray and bounding sphere intersects. |
[out] | distance | The distance from the ray origin to the point of intersection |
bool Ocular::Math::BoundsSphere::intersects | ( | BoundsSphere const & | bounds | ) | const |
Performs an intersection test on two bounding spheres.
[in] | bounds |
bool Ocular::Math::BoundsSphere::intersects | ( | BoundsAABB const & | bounds | ) | const |
Performs an intersection test on a bounding sphere and AABB.
[in] | bounds |
bool Ocular::Math::BoundsSphere::intersects | ( | BoundsOBB const & | bounds | ) | const |
Performs an intersection test on a bounding sphere and OBB.
[in] | bounds |
bool Ocular::Math::BoundsSphere::intersects | ( | Plane const & | plane, |
IntersectionType * | result = nullptr |
||
) | const |
Performs an intersection test on a plane and sphere.
If the result is Inside, then the sphere is located entirely within the plane's positive half space.
If the result is Outside, then the sphere 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.
[in] | plane | |
[out] | result | Detailed intersection result. |
void Ocular::Math::BoundsSphere::setCenter | ( | Vector3f const & | center | ) |
Sets the center of the bounding sphere.
[in] | center |
void Ocular::Math::BoundsSphere::setRadius | ( | float | radius | ) |
Sets the radius of the bounding sphere.
[in] | radius |