EBGeometry  1.0
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
BoundingVolumes::BoundingSphereT< T > Class Template Reference

Class which encloses a set of points using a bounding sphere. More...

#include <EBGeometry_BoundingVolumes.hpp>

Public Types

enum class  BoundingVolumeAlgorithm { Ritter }
 Typename for possible algorithms that support the computation of a bounding sphere for a set of 3D points.
 
using Vec3 = Vec3T< T >
 Alias to cut down on typing.
 

Public Member Functions

 BoundingSphereT () noexcept
 Default constructor. Leaves object in undefined state.
 
 BoundingSphereT (const Vec3T< T > &a_center, const T &a_radius) noexcept
 Full constructor. Sets the center and radius of the bounding sphere. More...
 
 BoundingSphereT (const std::vector< BoundingSphereT< T >> &a_otherSpheres) noexcept
 Full constructor. Constructs a bounding sphere that encloses all the other bounding spheres. More...
 
 BoundingSphereT (const BoundingSphereT &a_other) noexcept
 Copy constructor. Sets the center and radius from the other sphere. More...
 
template<class P >
 BoundingSphereT (const std::vector< Vec3T< P >> &a_points, const BoundingVolumeAlgorithm &a_alg=BoundingVolumeAlgorithm::Ritter) noexcept
 Template constructor which takes a set of 3D points (mixed precision allowed). More...
 
virtual ~BoundingSphereT () noexcept
 Destructor (does nothing).
 
BoundingSphereToperator= (const BoundingSphereT &a_other)=default
 Copy assignment operator. More...
 
template<class P >
void define (const std::vector< Vec3T< P >> &a_points, const BoundingVolumeAlgorithm &a_alg) noexcept
 Template define function which takes a set of 3D points (mixed precision allowed). More...
 
bool intersects (const BoundingSphereT &a_other) const noexcept
 Check if this bounding sphere intersect another bounding sphere. More...
 
T & getRadius () noexcept
 Get modifiable radius for this sphere.
 
const T & getRadius () const noexcept
 Get immutable radius for this sphere.
 
Vec3getCentroid () noexcept
 Get modifiable center for this sphere.
 
const Vec3getCentroid () const noexcept
 Get immutable center for this sphere.
 
getOverlappingVolume (const BoundingSphereT< T > &a_other) const noexcept
 Compute the overlapping volume between this bounding sphere and another. More...
 
getDistance (const Vec3 &a_x0) const noexcept
 Get the distance to this bounding sphere (points inside the sphere have a zero distance) More...
 
getVolume () const noexcept
 Get the sphere volume. More...
 
getArea () const noexcept
 Get the sphere area. More...
 

Protected Member Functions

template<class P >
void buildRitter (const std::vector< Vec3T< P >> &a_points) noexcept
 Template function which computes the bounding sphere for a set of points (mixed precision allowed) using Ritter's algorithm.
 

Protected Attributes

m_radius
 Sphere radius.
 
Vec3 m_center
 Sphere center.
 

Friends

std::ostream & operator<< (std::ostream &os, const BoundingSphereT< T > &sphere)
 For outputting a vector to an output stream.
 

Detailed Description

template<class T>
class BoundingVolumes::BoundingSphereT< T >

Class which encloses a set of points using a bounding sphere.

The template parameter T is the floating-point precision which is used.

Constructor & Destructor Documentation

◆ BoundingSphereT() [1/4]

template<class T >
BoundingVolumes::BoundingSphereT< T >::BoundingSphereT ( const Vec3T< T > &  a_center,
const T &  a_radius 
)
inlinenoexcept

Full constructor. Sets the center and radius of the bounding sphere.

Parameters
[in]a_centerBounding sphere center
[in]a_radiusBounding sphere radius

◆ BoundingSphereT() [2/4]

template<class T >
BoundingVolumes::BoundingSphereT< T >::BoundingSphereT ( const std::vector< BoundingSphereT< T >> &  a_otherSpheres)
inlinenoexcept

Full constructor. Constructs a bounding sphere that encloses all the other bounding spheres.

Parameters
[in]a_otherSpheresOther bounding spheres.

◆ BoundingSphereT() [3/4]

template<class T >
BoundingVolumes::BoundingSphereT< T >::BoundingSphereT ( const BoundingSphereT< T > &  a_other)
inlinenoexcept

Copy constructor. Sets the center and radius from the other sphere.

Parameters
[in]a_otherOther sphere

◆ BoundingSphereT() [4/4]

template<class T >
template<class P >
BoundingVolumes::BoundingSphereT< T >::BoundingSphereT ( const std::vector< Vec3T< P >> &  a_points,
const BoundingVolumeAlgorithm a_alg = BoundingVolumeAlgorithm::Ritter 
)
inlinenoexcept

Template constructor which takes a set of 3D points (mixed precision allowed).

This computes the bounding sphere using the supplied algorithm.

Parameters
[in]a_pointsSet of 3D points
[in]a_algBounding sphere algorithm.
Note
This calls the define(...) function.

Member Function Documentation

◆ define()

template<class T >
template<class P >
void BoundingVolumes::BoundingSphereT< T >::define ( const std::vector< Vec3T< P >> &  a_points,
const BoundingVolumeAlgorithm a_alg 
)
inlinenoexcept

Template define function which takes a set of 3D points (mixed precision allowed).

This computes the bounding sphere using the supplied algorithm.

Parameters
[in]a_pointsSet of 3D points
[in]a_algBounding sphere algorithm.

◆ getArea()

template<class T >
T BoundingVolumes::BoundingSphereT< T >::getArea ( ) const
inlinenoexcept

Get the sphere area.

Returns
Sphere area.

◆ getDistance()

template<class T >
T BoundingVolumes::BoundingSphereT< T >::getDistance ( const Vec3 a_x0) const
inlinenoexcept

Get the distance to this bounding sphere (points inside the sphere have a zero distance)

Parameters
[in]a_x03D point
Returns
Returns the distance to the sphere (a point inside has a zero distance)

◆ getOverlappingVolume()

template<class T >
T BoundingVolumes::BoundingSphereT< T >::getOverlappingVolume ( const BoundingSphereT< T > &  a_other) const
inlinenoexcept

Compute the overlapping volume between this bounding sphere and another.

Parameters
[in]a_otherOther bounding sphere
Returns
The overlapping volume, computing using standard expressions.

◆ getVolume()

template<class T >
T BoundingVolumes::BoundingSphereT< T >::getVolume ( ) const
inlinenoexcept

Get the sphere volume.

Returns
Sphere volume

◆ intersects()

template<class T >
bool BoundingVolumes::BoundingSphereT< T >::intersects ( const BoundingSphereT< T > &  a_other) const
inlinenoexcept

Check if this bounding sphere intersect another bounding sphere.

Parameters
[in]a_otherOther bounding sphere.
Returns
True if the two sphere intersect.

◆ operator=()

template<class T >
BoundingSphereT& BoundingVolumes::BoundingSphereT< T >::operator= ( const BoundingSphereT< T > &  a_other)
default

Copy assignment operator.

Parameters
[in]a_otherOther sphere

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