Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | Public Attributes | List of all members
om::math::Sphere3D< T > Class Template Reference

A class that represents a sphere in 3D space. More...

#include <omSphere3D.h>

Public Member Functions

 Sphere3D ()
 Create a sphere object that has a radius of 0 and a position centered at the origin. More...
 
 Sphere3D (const VectorND< T, 3 > &newPosition, T newRadius)
 Create a sphere object with the specified center position and radius. More...
 
 Sphere3D (const VectorND< T, 3 > &a, const VectorND< T, 3 > &b, const VectorND< T, 3 > &c)
 Create a sphere object that tightly bounds the specified 3 points in space. More...
 
 Sphere3D (const VectorND< T, 3 > *points, Size numPoints)
 Create a sphere object that encloses all of the points in the specified array. More...
 
 Sphere3D (const Sphere3D &sphere1, const Sphere3D &sphere2)
 Create a sphere object that encloses the two given bounding spheres. More...
 
template<typename U >
 Sphere3D (const Sphere3D< U > &other)
 Create a copy of a sphere object with another templated type. More...
 
template<typename U >
Sphere3Doperator= (const Sphere3D< U > &other)
 Assign a sphere object with another templated type to this bounding sphere. More...
 
Bool intersects (const Sphere3D &sphere) const
 Return whether or not this sphere intersects another. More...
 
void enlargeFor (const Sphere3D &other)
 Enlarge this bounding sphere so that it encloses both its original volume and another sphere. More...
 
void enlargeFor (const VectorND< T, 3 > &point)
 Enlarge this bounding sphere so that it encloses both its original volume and the given point. More...
 
Sphere3D operator| (const Sphere3D &sphere) const
 Compute the union of this bounding sphere with another. More...
 

Public Attributes

VectorND< T, 3 > position
 The position of the center of this Sphere3D. More...
 
radius
 The radius of this Sphere3D. More...
 

Detailed Description

template<typename T>
class om::math::Sphere3D< T >

A class that represents a sphere in 3D space.

Constructor & Destructor Documentation

template<typename T >
om::math::Sphere3D< T >::Sphere3D ( )
inline

Create a sphere object that has a radius of 0 and a position centered at the origin.

template<typename T >
om::math::Sphere3D< T >::Sphere3D ( const VectorND< T, 3 > &  newPosition,
newRadius 
)
inline

Create a sphere object with the specified center position and radius.

Parameters
newPosition- the position of the center of the Sphere3D in 3D space.
newRadius- the radius of the Sphere3D.
template<typename T >
om::math::Sphere3D< T >::Sphere3D ( const VectorND< T, 3 > &  a,
const VectorND< T, 3 > &  b,
const VectorND< T, 3 > &  c 
)
inline

Create a sphere object that tightly bounds the specified 3 points in space.

This constructor can be used to easily create a bounding sphere for a triangle.

Parameters
a- a point that should be enclosed by the Sphere3D.
b- a point that should be enclosed by the Sphere3D.
c- a point that should be enclosed by the Sphere3D.
template<typename T >
om::math::Sphere3D< T >::Sphere3D ( const VectorND< T, 3 > *  points,
Size  numPoints 
)
inline

Create a sphere object that encloses all of the points in the specified array.

This constructor uses an implementation-defined method of generating a bounding sphere for an arbitrary set of points in 3D space. The resulting sphere is not guaranteed to be a minimal bounding sphere but should offer a reasonably-tight fit of the input point set. The constructor uses numPoints sequential points from the array of input points to construct the bounding sphere. If the number of input points is 0 or the point array is NULL, the resulting sphere will be a sphere of 0 radius centered at the origin.

Parameters
points- a pointer to an array of input point data.
numPoints- the number of sequential points to use from the point array.
template<typename T >
om::math::Sphere3D< T >::Sphere3D ( const Sphere3D< T > &  sphere1,
const Sphere3D< T > &  sphere2 
)
inline

Create a sphere object that encloses the two given bounding spheres.

template<typename T >
template<typename U >
om::math::Sphere3D< T >::Sphere3D ( const Sphere3D< U > &  other)
inline

Create a copy of a sphere object with another templated type.

Parameters
other- the bounding sphere object that should be copied.

Member Function Documentation

template<typename T >
template<typename U >
Sphere3D& om::math::Sphere3D< T >::operator= ( const Sphere3D< U > &  other)
inline

Assign a sphere object with another templated type to this bounding sphere.

Parameters
other- the bounding sphere object that should be copied.
template<typename T >
Bool om::math::Sphere3D< T >::intersects ( const Sphere3D< T > &  sphere) const
inline

Return whether or not this sphere intersects another.

If the spheres intersect, TRUE is returned. Otherwise, FALSE is returned.

Parameters
sphere- the sphere to test for intersection with this Sphere3D.
Returns
whether or not this sphere intersects another.
template<typename T >
void om::math::Sphere3D< T >::enlargeFor ( const Sphere3D< T > &  other)
inline

Enlarge this bounding sphere so that it encloses both its original volume and another sphere.

template<typename T >
void om::math::Sphere3D< T >::enlargeFor ( const VectorND< T, 3 > &  point)
inline

Enlarge this bounding sphere so that it encloses both its original volume and the given point.

template<typename T >
Sphere3D om::math::Sphere3D< T >::operator| ( const Sphere3D< T > &  sphere) const
inline

Compute the union of this bounding sphere with another.

The resulting Sphere3D object is guaranteed to tightly bound both the L-value Sphere3D object as well as the R-value Sphere3D.

Parameters
sphere- the sphere to union with this Sphere3D.
Returns
a Sphere3D which encloses both spheres.

Member Data Documentation

template<typename T >
VectorND<T,3> om::math::Sphere3D< T >::position

The position of the center of this Sphere3D.

template<typename T >
T om::math::Sphere3D< T >::radius

The radius of this Sphere3D.


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