An axis-aligned rectangular prism in n dimensions.
More...
#include <NBox.h>
|
|
| NBox (const size_t _n) |
|
| NBox (const std::vector< double > &_center) |
|
virtual | ~NBox () noexcept |
|
|
size_t | GetDimension () const noexcept |
| Get the dimension of this box. More...
|
|
void | SetCenter (const std::vector< double > &_c) noexcept |
| Set the center point. More...
|
|
const std::vector< double > & | GetCenter () const noexcept |
| Get the center point. More...
|
|
const Range< double > & | GetRange (const size_t _i) const noexcept |
|
const std::vector< Range< double > > & | GetRanges () const noexcept |
| Get all of the ranges. More...
|
|
void | SetRange (const size_t _i, const Range< double > &_r) noexcept |
|
void | SetRange (const size_t _i, Range< double > &&_r) noexcept |
|
void | SetRange (const size_t _i, const double _min, const double _max) noexcept |
|
void | Translate (const std::vector< double > &_v) noexcept |
|
double | GetVolume () const noexcept |
| Compute the (hyper)volume or Lebesgue measure. More...
|
|
|
If the box 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 (const std::vector< double > &_p) const noexcept |
|
std::vector< double > | ClearancePoint (std::vector< double > _p) const noexcept |
|
|
std::vector< double > | Sample () const |
| Sample a random point in the box with uniform probability. More...
|
|
An axis-aligned rectangular prism in n dimensions.
◆ NBox() [1/2]
NBox::NBox |
( |
const size_t |
_n | ) |
|
|
explicit |
Construct an infinite box centered at the origin in _n dimensions.
- Parameters
-
_n | The number of dimensions. |
◆ NBox() [2/2]
NBox::NBox |
( |
const std::vector< double > & |
_center | ) |
|
|
explicit |
Construct an infinite box with a designated center point.
- Parameters
-
_center | The center point, which is assumed to be of full dimension. |
◆ ~NBox()
◆ Clearance()
double NBox::Clearance |
( |
const std::vector< double > & |
_p | ) |
const |
|
noexcept |
Compute the minimum distance to the box's surface from a given point. This is bounding-box style, so clearance is positive if the point is inside the box and negative if it is outside.
- Parameters
-
- Returns
- The minimum distance from _p to the box's surface.
◆ ClearancePoint()
std::vector< double > NBox::ClearancePoint |
( |
std::vector< double > |
_p | ) |
const |
|
noexcept |
Find the point on the box that is nearest to a given reference point.
- Parameters
-
- Returns
- The point on the surface that is nearest to _p.
◆ Contains()
bool NBox::Contains |
( |
const std::vector< double > & |
_p | ) |
const |
|
noexcept |
Test if a given point lies within the box.
- Parameters
-
- Returns
- True if _p lies within the box.
◆ GetCenter()
const std::vector< double > & NBox::GetCenter |
( |
| ) |
const |
|
noexcept |
◆ GetDimension()
size_t NBox::GetDimension |
( |
| ) |
const |
|
noexcept |
Get the dimension of this box.
◆ GetRange()
const Range< double > & NBox::GetRange |
( |
const size_t |
_i | ) |
const |
|
noexcept |
Get a range in a given dimension.
- Parameters
-
- Returns
- The range of this volume in dimension _i.
◆ GetRanges()
const std::vector< Range< double > > & NBox::GetRanges |
( |
| ) |
const |
|
noexcept |
◆ GetVolume()
double NBox::GetVolume |
( |
| ) |
const |
|
noexcept |
Compute the (hyper)volume or Lebesgue measure.
◆ Sample()
std::vector< double > NBox::Sample |
( |
| ) |
const |
Sample a random point in the box with uniform probability.
◆ SetCenter()
void NBox::SetCenter |
( |
const std::vector< double > & |
_c | ) |
|
|
noexcept |
◆ SetRange() [1/3]
void NBox::SetRange |
( |
const size_t |
_i, |
|
|
const double |
_min, |
|
|
const double |
_max |
|
) |
| |
|
noexcept |
Set the range in a given dimension.
- Parameters
-
_i | The dimension index. |
_min | The new lower bound. |
_max | The new upper bound. |
◆ SetRange() [2/3]
void NBox::SetRange |
( |
const size_t |
_i, |
|
|
const Range< double > & |
_r |
|
) |
| |
|
noexcept |
Set the range in a given dimension.
- Parameters
-
_i | The dimension index. |
_r | The new range to use. |
◆ SetRange() [3/3]
void NBox::SetRange |
( |
const size_t |
_i, |
|
|
Range< double > && |
_r |
|
) |
| |
|
noexcept |
◆ Translate()
void NBox::Translate |
( |
const std::vector< double > & |
_v | ) |
|
|
noexcept |
Translate the entire n-box.
- Parameters
-
_v | The translation vector to apply. If it has fewer dimensions than the NBox, it will be applied to the first (_v.size()) dimensions of this. |
◆ operator>>
std::istream& operator>> |
( |
std::istream & |
_is, |
|
|
NBox & |
_box |
|
) |
| |
|
friend |
The documentation for this class was generated from the following files:
- /opt/actions-runner/_work/open-ppl/open-ppl/src/Geometry/Shapes/NBox.h
- /opt/actions-runner/_work/open-ppl/open-ppl/src/Geometry/Shapes/NBox.cpp