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

A class that represents a sphere in 2D space (a circle). More...

#include <omSphere2D.h>

Public Member Functions

 Sphere2D ()
 Create a sphere object that has a radius of 0 and a position centered at the origin. More...
 
 Sphere2D (const VectorND< T, 2 > &newPosition, T newRadius)
 Create a sphere object with the specified center position and radius. More...
 
 Sphere2D (const Sphere2D &sphere1, const Sphere2D &sphere2)
 Create a sphere object that encloses the two given bounding spheres. More...
 
template<typename U >
 Sphere2D (const Sphere2D< U > &other)
 Create a copy of a sphere object with another templated type. More...
 
template<typename U >
Sphere2Doperator= (const Sphere2D< U > &other)
 Assign a sphere object with another templated type to this bounding sphere. More...
 
Bool intersects (const Sphere2D &sphere) const
 Return whether or not this sphere intersects another. More...
 
void enlargeFor (const Sphere2D &other)
 Enlarge this bounding sphere so that it encloses both its original volume and the new sphere. More...
 
void enlargeFor (const VectorND< T, 2 > &point)
 Enlarge this bounding sphere so that it encloses both its original volume and the given point. More...
 
Sphere2D operator| (const Sphere2D &sphere) const
 Compute the union of this bounding sphere with another. More...
 

Public Attributes

VectorND< T, 2 > position
 The position of the center of this 2D sphere. More...
 
radius
 The radius of this 2D sphere. More...
 

Detailed Description

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

A class that represents a sphere in 2D space (a circle).

Constructor & Destructor Documentation

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

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

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

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

Parameters
newPosition- the position of the center of the Sphere2D in 2D space.
newRadius- the radius of the Sphere2D.
template<typename T >
om::math::Sphere2D< T >::Sphere2D ( const Sphere2D< T > &  sphere1,
const Sphere2D< T > &  sphere2 
)
inline

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

template<typename T >
template<typename U >
om::math::Sphere2D< T >::Sphere2D ( const Sphere2D< 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 >
Sphere2D& om::math::Sphere2D< T >::operator= ( const Sphere2D< 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::Sphere2D< T >::intersects ( const Sphere2D< 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 Sphere2D.
Returns
whether or not this sphere intersects another.
template<typename T >
void om::math::Sphere2D< T >::enlargeFor ( const Sphere2D< T > &  other)
inline

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

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

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

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

Compute the union of this bounding sphere with another.

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

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

Member Data Documentation

template<typename T >
VectorND<T,2> om::math::Sphere2D< T >::position

The position of the center of this 2D sphere.

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

The radius of this 2D sphere.


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