![]() |
Parasol Planning Library (PPL)
|
#include <NSphere.h>
Public Member Functions | |
Construction | |
NSphere (const size_t _n, const double _r=std::numeric_limits< double >::max()) | |
NSphere (const std::vector< double > &_center, const double _r=std::numeric_limits< double >::max()) | |
virtual | ~NSphere () noexcept |
Accessors | |
size_t | GetDimension () const noexcept |
Get the dimension of this sphere. More... | |
void | SetCenter (const std::vector< double > &_c) noexcept |
const std::vector< double > & | GetCenter () const noexcept |
Get the center point. More... | |
double | GetRadius () const noexcept |
Get the radius. More... | |
void | SetRadius (const double _r) noexcept |
Set the radius. More... | |
void | Translate (const std::vector< double > &_v) noexcept |
double | GetVolume () const noexcept |
Compute the (hyper)volume or Lebesgue measure. More... | |
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, NSphere &_sphere) |
A general representation of a spherical volume in N dimensions.
This object also models the inscribed hyper-volume, so the proper formal name for it is an 'N-ball'. I.e., setting N = 3 creates a (two-)sphere in R^3 plus the inscribed volume. See wikipedia's article on n-sphere for further clarification.
|
explicit |
Construct an n-sphere at the origin with a given dimension and radius.
_n | The dimension of the n-sphere. |
_r | The sphere radius (infinite by default). |
|
explicit |
Construct an n-sphere with a given center point and radius.
_c | The center point of the n-sphere, which is assumed to be of full dimension. |
_r | The sphere radius (infinite by default). |
|
virtualdefaultnoexcept |
|
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.
_p | The point of interest. |
|
noexcept |
Find the point on the sphere that is nearest to a given reference point.
_p | The reference point. |
|
noexcept |
Test if a given point lies within the n-sphere.
_p | The point to test. |
|
noexcept |
Get the center point.
|
noexcept |
Get the dimension of this sphere.
|
noexcept |
Get the radius.
|
noexcept |
Compute the (hyper)volume or Lebesgue measure.
std::vector< double > NSphere::Sample | ( | ) | const |
Sample a random point in the n-sphere with uniform probability via the Muller/Marsaglia method.
|
noexcept |
Set the center point.
_c | The new center point. |
|
noexcept |
Set the radius.
|
noexcept |
Translate the entire n-sphere.
_v | The translation vector to apply. |
|
friend |