50 void addPlane(
const MDPlane &plane);
64 throw std::runtime_error(
"Cannot call MDImplicitFunction does not implement getName()");
69 throw std::runtime_error(
"Cannot call MDImplicitFunction does not implement toXMLString()");
96 const auto it = std::find_if(m_planes.begin(), m_planes.end(),
97 [coords](
const MDPlane &plane) { return !plane.isPointBounded(coords); });
98 return it == m_planes.end();
110 const auto it = std::find_if(m_planes.begin(), m_planes.end(),
111 [coords](
const MDPlane &plane) { return !plane.isPointBounded(coords); });
112 return it == m_planes.end();
124 const auto it = std::find_if(m_planes.begin(), m_planes.end(),
125 [coords](
const MDPlane &plane) { return !plane.isPointBounded(coords); });
126 return it == m_planes.end();
158 return std::all_of(m_planes.cbegin(), m_planes.cbegin() + m_numPlanes, [&vertexes](
const MDPlane &plane) {
159 return std::any_of(vertexes.cbegin(), vertexes.cend(),
160 [&plane](const std::vector<coord_t> &vertex) { return plane.isPointBounded(vertex); });
178 for (
size_t i = 0; i < m_numPlanes; i++) {
179 size_t numBounded = 0;
180 for (
size_t j = 0; j < numPoints; j++) {
181 if (m_planes[i].isPointBounded(vertexes + j * m_nd)) {
212 bool lookForFullyContained =
true;
216 for (
size_t i = 0; i < m_numPlanes; i++) {
217 size_t numBounded = 0;
218 for (
size_t j = 0; j < numPoints; j++) {
219 if (m_planes[i].isPointBounded(vertexes + j * m_nd)) {
223 if (!lookForFullyContained)
228 lookForFullyContained =
false;
236 if (numBounded != numPoints)
237 lookForFullyContained =
false;
241 if (lookForFullyContained)
std::map< DeltaEMode::Type, std::string > index
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
eContact boxContact(const coord_t *vertexes, const size_t numPoints) const
Determine how a box (consisting of a number of vertexes) is in contact with the implicit function.
eContact
Enum for describing the contact between a box and an implicit function.
size_t getNumDims() const
virtual bool isPointContained(const std::vector< coord_t > &coords)
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes c...
virtual bool isPointContained(const Mantid::Kernel::VMD &coords)
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes c...
size_t m_numPlanes
Cached number of planes (for a sligh speed-up)
virtual std::string getName() const
virtual bool isPointContained(const coord_t *coords)
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes c...
bool isBoxTouching(const std::vector< std::vector< coord_t > > &vertexes)
Is there a chance that the box defined by these vertexes touches the implicit function volume?
size_t getNumPlanes() const
std::vector< MDPlane > m_planes
Vector of all the planes applying for this implict function.
virtual ~MDImplicitFunction()=default
size_t m_nd
number of dimensions for which this object can be applied
virtual std::string toXMLString() const
const MDPlane & getPlane(size_t index) const
bool isBoxTouching(const coord_t *vertexes, const size_t numPoints)
Same as isBoxTouching(vector), except that it takes a bare array of coordinates.
A generalized description of a N-dimensional hyperplane.
std::shared_ptr< MDImplicitFunction > MDImplicitFunction_sptr
Helper class which provides the Collimation Length for SANS instruments.
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...