54 size_t nd = min.
size();
56 throw std::invalid_argument(
"MDBoxImplicitFunction::ctor(): Min and max vector sizes must match!");
57 if (nd == 0 || nd > 100)
58 throw std::invalid_argument(
"MDBoxImplicitFunction::ctor(): Invalid number of dimensions!");
61 for (
size_t d = 0;
d < nd;
d++) {
62 boxVolume *= (max[
d] - min[
d]);
67 std::vector<coord_t> normal_min(nd, 0);
71 std::vector<coord_t> origin_min(nd, 0);
72 origin_min[
d] =
static_cast<coord_t>(min[
d]);
74 MDPlane p_min(normal_min, origin_min);
78 std::vector<coord_t> normal_max(nd, 0);
82 std::vector<coord_t> origin_max(nd, 0);
83 origin_max[
d] =
static_cast<coord_t>(max[
d]);
85 MDPlane p_max(normal_max, origin_max);
108 for (
size_t d = 0;
d < nd; ++
d) {
110 const coord_t min = boxExtents[
d].get<0>();
111 const coord_t max = boxExtents[
d].get<1>();
120 const coord_t dBoxRange = (max - min);
123 const coord_t dOverlap = dInnerMax - dInnerMin;
125 frac *= dOverlap / dBoxRange;
MDBoxImplicitFunction(const Mantid::Kernel::VMD &min, const Mantid::Kernel::VMD &max)
Constructor with min/max dimensions.
void construct(const Mantid::Kernel::VMD &min, const Mantid::Kernel::VMD &max)
Constructor helper method.
const Mantid::Kernel::VMD m_max
Maximum extents of MDBox.
const Mantid::Kernel::VMD m_min
Minimum extents of MDBox.
double volume() const
Calculate volume.
double m_volume
Box volume.
double fraction(const std::vector< boost::tuple< Mantid::coord_t, Mantid::coord_t > > &boxExtents) const
Calculate the fraction of a box residing inside this implicit function.
void addPlane(const MDPlane &plane)
Add a bounded plane to this implicit function.
A generalized description of a N-dimensional hyperplane.
VMDBase< VMD_t > VMD
Define the VMD as using the double or float data type.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...