MAGE  v0.171.0
Matthias Advanced Game Engine
mage::BoundingSphere Class Reference

#include <bounding_volume.hpp>

Public Member Functions

 BoundingSphere () noexcept
 
 BoundingSphere (const Point3 &p) noexcept
 
 BoundingSphere (FXMVECTOR p) noexcept
 
 BoundingSphere (const Point3 &p, F32 r) noexcept
 
 BoundingSphere (FXMVECTOR p, F32 r) noexcept
 
 BoundingSphere (const AABB &aabb) noexcept
 
 BoundingSphere (const BoundingSphere &sphere) noexcept=default
 
 BoundingSphere (BoundingSphere &&sphere) noexcept=default
 
 ~BoundingSphere ()=default
 
BoundingSphereoperator= (const BoundingSphere &sphere) noexcept=default
 
BoundingSphereoperator= (BoundingSphere &&sphere) noexcept=default
 
const XMVECTOR XM_CALLCONV Centroid () const noexcept
 
F32 Radius () const noexcept
 
bool Encloses (const Point3 &point) const noexcept
 
bool EnclosesStrict (const Point3 &point) const noexcept
 
bool XM_CALLCONV Encloses (FXMVECTOR point) const noexcept
 
bool XM_CALLCONV EnclosesStrict (FXMVECTOR point) const noexcept
 
bool Encloses (const AABB &aabb) const noexcept
 
bool EnclosesStrict (const AABB &aabb) const noexcept
 
bool Encloses (const BoundingSphere &sphere) const noexcept
 
bool EnclosesStrict (const BoundingSphere &sphere) const noexcept
 
bool Overlaps (const BoundingSphere &sphere) const noexcept
 
bool OverlapsStrict (const BoundingSphere &sphere) const noexcept
 
bool operator== (const BoundingSphere &sphere) const noexcept
 
bool operator!= (const BoundingSphere &sphere) const noexcept
 

Static Public Member Functions

static const BoundingSphere XM_CALLCONV Union (const BoundingSphere &sphere, const Point3 &point) noexcept
 
template<typename VertexT >
static const BoundingSphere XM_CALLCONV Union (const BoundingSphere &sphere, const VertexT &vertex) noexcept
 
static const BoundingSphere XM_CALLCONV Union (const BoundingSphere &sphere, FXMVECTOR point) noexcept
 
static const BoundingSphere XM_CALLCONV Maximum () noexcept
 

Private Attributes

XMVECTOR m_pr
 

Detailed Description

A class of Bounding Spheres.

Constructor & Destructor Documentation

◆ BoundingSphere() [1/8]

mage::BoundingSphere::BoundingSphere ( )
noexcept

Constructs a bounding sphere.

◆ BoundingSphere() [2/8]

mage::BoundingSphere::BoundingSphere ( const Point3 p)
explicitnoexcept

Constructs a bounding sphere of the given point.

Parameters
[in]pA reference to the point.

◆ BoundingSphere() [3/8]

mage::BoundingSphere::BoundingSphere ( FXMVECTOR  p)
explicitnoexcept

Constructs a bounding sphere of the given point.

Parameters
[in]pThe point.

◆ BoundingSphere() [4/8]

mage::BoundingSphere::BoundingSphere ( const Point3 p,
F32  r 
)
noexcept

Constructs a BoundingSphere.

Parameters
[in]pA reference to the position.
[in]rThe radius.

◆ BoundingSphere() [5/8]

mage::BoundingSphere::BoundingSphere ( FXMVECTOR  p,
F32  r 
)
noexcept

Constructs a bounding sphere.

Parameters
[in]pThe position.
[in]rThe radius.

◆ BoundingSphere() [6/8]

mage::BoundingSphere::BoundingSphere ( const AABB aabb)
explicitnoexcept

Constructs a bounding sphere from the given AABB.

Parameters
[in]aabbA reference to the aabb.

◆ BoundingSphere() [7/8]

mage::BoundingSphere::BoundingSphere ( const BoundingSphere sphere)
defaultnoexcept

Constructs a bounding sphere from the given bounding sphere.

Parameters
[in]sphereA reference to the sphere to copy.

◆ BoundingSphere() [8/8]

mage::BoundingSphere::BoundingSphere ( BoundingSphere &&  sphere)
defaultnoexcept

Constructs a bounding sphere by moving the given bounding sphere.

Parameters
[in]sphereA reference to the sphere to move.

◆ ~BoundingSphere()

mage::BoundingSphere::~BoundingSphere ( )
default

Destructs this bounding sphere.

Member Function Documentation

◆ Centroid()

const XMVECTOR XM_CALLCONV mage::BoundingSphere::Centroid ( ) const
noexcept

Returns the centroid of this bounding sphere.

Returns
The centroid of this bounding sphere.

◆ Encloses() [1/4]

bool mage::BoundingSphere::Encloses ( const Point3 point) const
noexcept

Checks whether this bounding sphere completely encloses the given point.

Parameters
[in]pointA reference to the point.
Returns
true if this bounding sphere completely encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding sphere.

◆ Encloses() [2/4]

bool XM_CALLCONV mage::BoundingSphere::Encloses ( FXMVECTOR  point) const
noexcept

Checks whether this bounding sphere completely encloses the given point.

Parameters
[in]pointThe point.
Returns
true if this bounding sphere completely encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding sphere.

◆ Encloses() [3/4]

bool mage::BoundingSphere::Encloses ( const AABB aabb) const
noexcept

Checks whether this bounding sphere completely encloses the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding sphere completely encloses aabb. false otherwise.
Note
This is a full coverage test of an AABB with regard to a bounding sphere.

◆ Encloses() [4/4]

bool mage::BoundingSphere::Encloses ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding sphere completely encloses the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding sphere completely encloses sphere. false otherwise.
Note
This is a full coverage test of a bounding sphere with regard to a bounding sphere.

◆ EnclosesStrict() [1/4]

bool mage::BoundingSphere::EnclosesStrict ( const Point3 point) const
noexcept

Checks whether this bounding sphere completely, strictly encloses the given point.

Parameters
[in]pointA reference to the point.
Returns
true if this bounding sphere completely, strictly encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding sphere.

◆ EnclosesStrict() [2/4]

bool XM_CALLCONV mage::BoundingSphere::EnclosesStrict ( FXMVECTOR  point) const
noexcept

Checks whether this bounding sphere completely, strictly encloses the given point.

Parameters
[in]pointThe point.
Returns
true if this bounding sphere completely, strictly encloses point. false otherwise.
Note
This is a full coverage test of a point with regard to a bounding sphere.

◆ EnclosesStrict() [3/4]

bool mage::BoundingSphere::EnclosesStrict ( const AABB aabb) const
noexcept

Checks whether this bounding sphere completely, strictly encloses the given AABB.

Parameters
[in]aabbA reference to the AABB.
Returns
true if this bounding sphere completely, strictly encloses aabb. false otherwise.
Note
This is a full coverage test of an AABB with regard to a bounding sphere.

◆ EnclosesStrict() [4/4]

bool mage::BoundingSphere::EnclosesStrict ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding sphere completely, strictly encloses the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding sphere completely, strictly encloses sphere. false otherwise.
Note
This is a full coverage test of a bounding sphere with regard to a bounding sphere.

◆ Maximum()

static const BoundingSphere XM_CALLCONV mage::BoundingSphere::Maximum ( )
staticnoexcept

Returns the maximum bounding sphere (i.e. the bounding sphere that is invariant for union operations).

Returns
The maximum bounding sphere.

◆ operator!=()

bool mage::BoundingSphere::operator!= ( const BoundingSphere sphere) const
noexcept

Checks whether the given bounding sphere is not equal to this bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if the given bounding sphere is equal to this bounding sphere. false otherwise.

◆ operator=() [1/2]

BoundingSphere& mage::BoundingSphere::operator= ( const BoundingSphere sphere)
defaultnoexcept

Copies the given bounding sphere to this bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere to copy.
Returns
A reference to the copy of the given bounding sphere (i.e. this bounding sphere).

◆ operator=() [2/2]

BoundingSphere& mage::BoundingSphere::operator= ( BoundingSphere &&  sphere)
defaultnoexcept

Moves the given bounding sphere to this bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere to move.
Returns
A reference to the moved bounding sphere (i.e. this bounding sphere).

◆ operator==()

bool mage::BoundingSphere::operator== ( const BoundingSphere sphere) const
noexcept

Checks whether the given bounding sphere is equal to this bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if the given bounding sphere is equal to this bounding sphere. false otherwise.

◆ Overlaps()

bool mage::BoundingSphere::Overlaps ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding sphere overlaps the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding sphere overlaps sphere. false otherwise.
Note
This is a (partial or full) coverage test of a bounding sphere with regard to an bounding sphere.

◆ OverlapsStrict()

bool mage::BoundingSphere::OverlapsStrict ( const BoundingSphere sphere) const
noexcept

Checks whether this bounding sphere strictly overlaps the given bounding sphere.

Parameters
[in]sphereA reference to the bounding sphere.
Returns
true if this bounding sphere strictly overlaps sphere. false otherwise.
Note
This is a (partial or full) coverage test of a bounding sphere with regard to an bounding sphere.

◆ Radius()

F32 mage::BoundingSphere::Radius ( ) const
noexcept

Returns the radius of this bounding sphere.

Returns
The radius of this bounding sphere.

◆ Union() [1/3]

static const BoundingSphere XM_CALLCONV mage::BoundingSphere::Union ( const BoundingSphere sphere,
const Point3 point 
)
staticnoexcept

Returns the union bounding sphere of the given bounding sphere and the given point.

Parameters
[in]sphereA reference to the bounding sphere.
[in]pointA reference to the point.
Returns
The union bounding sphere of sphere and point.

◆ Union() [2/3]

template<typename VertexT >
static const BoundingSphere XM_CALLCONV mage::BoundingSphere::Union ( const BoundingSphere sphere,
const VertexT &  vertex 
)
staticnoexcept

Returns the union bounding sphere of the given bounding sphere and the given vertex.

Template Parameters
VertexTThe vertex type.
Parameters
[in]sphereA reference to the bounding sphere.
[in]vertexA reference to the vertex.
Returns
The union bounding sphere of sphere and vertex.

◆ Union() [3/3]

static const BoundingSphere XM_CALLCONV mage::BoundingSphere::Union ( const BoundingSphere sphere,
FXMVECTOR  point 
)
staticnoexcept

Returns the union bounding sphere of the given bounding sphere and the given point.

Parameters
[in]sphereA reference to the bounding sphere.
[in]pointThe point.
Returns
The union bounding sphere of sphere and point.

Member Data Documentation

◆ m_pr

XMVECTOR mage::BoundingSphere::m_pr
private

The position and radus of this bounding sphere.