Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvmath::BoundingSphere Class Reference

Sphere class that represents the bounding sphere of a set of points. More...

#include <BoundingSphere.h>

Inheritance diagram for nvmath::BoundingSphere:

Inheritance graph
[legend]
Collaboration diagram for nvmath::BoundingSphere:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 BoundingSphere ()
 Constructor.
NVSG_API bool extend (const Sphere3f &sphere)
 Extend this BoundingSphere by a sphere.
NVSG_API const Sphere3fgetSphere (void) const
 Get the sphere.
NVSG_API void setSphere (const Sphere3f &sphere)
 Set the sphere.
NVSG_API const Vec3fgetCenter (void) const
 Get the center.
NVSG_API float getRadius (void) const
 Get the radius.
NVSG_API void invalidate (void)
 Invalidate the BoundingSphere.
NVSG_API bool isValid (void) const
 Determine if the BoundingSphere is valid.
NVSG_API bool set (const Vec3f *vertices, size_t numVertices)
 Set the BoundingSphere to include a vector of points.
NVSG_API void transform (const Mat44f &m)
 Transform the BoundingSphere by a matrix.
NVSG_API void enlarge (float factor)
 Enlarge the bounding sphere by a factor.

Detailed Description

Sphere class that represents the bounding sphere of a set of points.

Because determining the optimal bounding sphere of a set of points is rather cumbersome, this BoundingSphere is an approximation that uses the baricenter of a set of points. On extending a BoundingSphere with another, the sphere that includes both and is tangent to them is used.


Constructor & Destructor Documentation

nvmath::BoundingSphere::BoundingSphere  )  [inline]
 

Constructor.


Member Function Documentation

bool nvmath::BoundingSphere::extend const Sphere3f sphere  )  [inline]
 

Extend this BoundingSphere by a sphere.

This BoundingSphere is extended to include the given sphere. If they don't include each other the new sphere is tangent to both of them.

Returns:
true if the extended BoundingSphere is valid, otherwise false
Parameters:
sphere  sphere to extend with

const Sphere3f & nvmath::BoundingSphere::getSphere void   )  const [inline]
 

Get the sphere.

It is assumed that this BoundingSphere is valid.

Returns:
This BoundingSphere as a Sphere3f.

void nvmath::BoundingSphere::setSphere const Sphere3f sphere  )  [inline]
 

Set the sphere.

Makes the BoundingSphere valid.

const Vec3f & nvmath::BoundingSphere::getCenter void   )  const [inline]
 

Get the center.

It is assumed that this BoundingSphere is valid.

Returns:
The center of this BoundingSphere.

Reimplemented from nvmath::Sphere3f.

float nvmath::BoundingSphere::getRadius void   )  const [inline]
 

Get the radius.

It is assumed that this BoundingSphere is valid.

Returns:
The radius of this BoundingSphere.

Reimplemented from nvmath::Sphere3f.

void nvmath::BoundingSphere::invalidate void   )  [inline]
 

Invalidate the BoundingSphere.

Marks this BoundingSphere as invalid. After this, neither center nor radius can be assumed to be valid.

bool nvmath::BoundingSphere::isValid void   )  const [inline]
 

Determine if the BoundingSphere is valid.

A BoundingSphere is valid if it has been set with at least two points.

Returns:
true if the BoundingSphere is valid, otherwise false

bool nvmath::BoundingSphere::set const Vec3f vertices,
size_t  numVertices
[inline]
 

Set the BoundingSphere to include a vector of points.

A BoundingSphere of the given points is calculated by using the baricenter of the points as the center of the BoundingSphere.

Parameters:
vertices  points to be bounded by a sphere
numVertices  number of points

void nvmath::BoundingSphere::transform const Mat44f m  )  [inline]
 

Transform the BoundingSphere by a matrix.

The center of the BoundingSphere is pre-multiplied by the given matrix.

Parameters:
m  matrix to use in the transformation

void nvmath::BoundingSphere::enlarge float  factor  )  [inline]
 

Enlarge the bounding sphere by a factor.

Parameters:
factor  factor to use for enlarging the bounding sphere


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:39 2005 for NVSGSDK by NVIDIA