PPL API Reference
Overview Core Algorithm Abstractions Utilities Parallel Methods
Modules Class Hierarchy Classes Functions
Todo List Bug List Dead Code
List of all members | Friends
NSphericalShell Class Reference

Public Member Functions

Construction
 NSphericalShell (const size_t _n, const double _outer=std::numeric_limits< double >::max(), const double _inner=0)
 
 NSphericalShell (const std::vector< double > &_center, const double _outer=std::numeric_limits< double >::max(), const double _inner=0)
 
virtual ~NSphericalShell () noexcept
 
Accessors
size_t GetDimension () const noexcept
 Get the dimension of this sphere.
 
void SetCenter (const std::vector< double > &_c) noexcept
 
const std::vector< double > & GetCenter () const noexcept
 Get the center point.
 
double GetOuterRadius () const noexcept
 Get the outer radius.
 
double GetInnerRadius () const noexcept
 Get the inner radius.
 
void SetOuterRadius (const double _r) noexcept
 Set the outer radius.
 
void SetInnerRadius (const double _r) noexcept
 Set the inner radius.
 
void Translate (const std::vector< double > &_v) noexcept
 
double GetVolume () const noexcept
 Compute the (hyper)volume or Lebesgue measure.
 
Point Testing

If the sphere and point have different dimensions, the missing values will be assumed to be 0.

bool Contains (const std::vector< double > &_p) const noexcept
 
double Clearance (std::vector< double > _p) const noexcept
 
std::vector< double > ClearancePoint (std::vector< double > _p) const noexcept
 
Sampling
std::vector< double > Sample () const
 

Friends

std::istream & operator>> (std::istream &_is, NSphericalShell &_sphere)
 

Detailed Description

A general representation of a spherical shell volume in N dimensions (i.e., a spherical volume with an outer and inner radius).

Like NSphere, this object also models the inscribed hyper-volume.

Constructor & Destructor Documentation

◆ NSphericalShell() [1/2]

NSphericalShell::NSphericalShell ( const size_t  _n,
const double  _outer = std::numeric_limits<double>::max(),
const double  _inner = 0 
)
explicit

Construct an n-spherical shell at the origin with a given dimension and radius.

Parameters
_nThe dimension.
_outerThe outer radius (infinite by default).
_innerThe inner radius (0 by default).

◆ NSphericalShell() [2/2]

NSphericalShell::NSphericalShell ( const std::vector< double > &  _center,
const double  _outer = std::numeric_limits<double>::max(),
const double  _inner = 0 
)
explicit

Construct an n-spherical shell with a given center point and radius.

Parameters
_cThe center point, which is assumed to be of full dimension.
_outerThe outer radius (infinite by default).
_innerThe inner radius (0 by default).

Member Function Documentation

◆ SetCenter()

void NSphericalShell::SetCenter ( const std::vector< double > &  _c)
noexcept

Set the center point.

Parameters
_cThe new center point.

◆ Translate()

void NSphericalShell::Translate ( const std::vector< double > &  _v)
noexcept

Translate the entire n-spherical shell.

Parameters
_vThe translation vector to apply.

◆ Contains()

bool NSphericalShell::Contains ( const std::vector< double > &  _p) const
noexcept

Test if a given point lies within the n-spherical shell.

Parameters
_pThe point to test.
Returns
True if _p lies within the n-spherical shell.

◆ Clearance()

double NSphericalShell::Clearance ( std::vector< double >  _p) const
noexcept

Compute the minimum distance to the sphere's surface from a given point. This is bounding-sphere style, so clearance is positive if the point is inside the sphere and negative if it is outside.

Parameters
_pThe point of interest.
Returns
The minimum distance from _p to the sphere's surface.

◆ ClearancePoint()

std::vector< double > NSphericalShell::ClearancePoint ( std::vector< double >  _p) const
noexcept

Find the point on the sphere that is nearest to a given reference point.

Parameters
_pThe reference point.
Returns
The point on the surface that is nearest to _p.

◆ Sample()

std::vector< double > NSphericalShell::Sample ( ) const

Sample a random point in the n-spherical shell with uniform probability via the Muller/Marsaglia method.


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