23 explicit NBox(
const size_t _n);
28 explicit NBox(
const std::vector<double>& _center);
40 void SetCenter(const std::vector<
double>& _c) noexcept;
43 const std::vector<
double>&
GetCenter() const noexcept;
48 const
Range<
double>&
GetRange(const
size_t _i) const noexcept;
56 void SetRange(const
size_t _i, const
Range<
double>& _r) noexcept;
63 void SetRange(const
size_t _i, const
double _min, const
double _max) noexcept;
69 void Translate(const std::vector<
double>& _v) noexcept;
83 bool Contains(const std::vector<
double>& _p) const noexcept;
90 double Clearance(const std::vector<
double>& _p) const noexcept;
95 std::vector<
double>
ClearancePoint(std::vector<
double> _p) const noexcept;
102 std::vector<
double>
Sample() const;
111 std::vector<
double> m_center;
112 std::vector<
Range<
double>> m_range;
116 friend std::istream& operator>>(std::istream& _is,
NBox& _box);
122 operator>>(std::istream& _is,
NBox& _box);
125 operator<<(std::ostream& _os, const
NBox& _box);
An axis-aligned rectangular prism in n dimensions.
Definition: NBox.h:14
void SetRange(const size_t _i, const Range< double > &_r) noexcept
Definition: NBox.cpp:74
size_t GetDimension() const noexcept
Get the dimension of this box.
Definition: NBox.cpp:33
std::vector< double > ClearancePoint(std::vector< double > _p) const noexcept
Definition: NBox.cpp:153
void SetCenter(const std::vector< double > &_c) noexcept
Set the center point.
Definition: NBox.cpp:40
const Range< double > & GetRange(const size_t _i) const noexcept
Definition: NBox.cpp:60
const std::vector< double > & GetCenter() const noexcept
Get the center point.
Definition: NBox.cpp:53
bool Contains(const std::vector< double > &_p) const noexcept
Definition: NBox.cpp:121
std::vector< double > Sample() const
Sample a random point in the box with uniform probability.
Definition: NBox.cpp:197
void Translate(const std::vector< double > &_v) noexcept
Definition: NBox.cpp:98
NBox(const size_t _n)
Definition: NBox.cpp:13
double GetVolume() const noexcept
Compute the (hyper)volume or Lebesgue measure.
Definition: NBox.cpp:110
double Clearance(const std::vector< double > &_p) const noexcept
Definition: NBox.cpp:132
const std::vector< Range< double > > & GetRanges() const noexcept
Get all of the ranges.
Definition: NBox.cpp:67
A range of numeric values.
Definition: Range.h:17