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();
159 for (
size_t i = 0; i < m_numPlanes; i++) {
160 const bool anyBounded =
161 std::any_of(vertexes.cbegin(), vertexes.cend(),
162 [
this, i](
const std::vector<coord_t> &vertex) { return m_planes[i].isPointBounded(vertex); });
186 for (
size_t i = 0; i < m_numPlanes; i++) {
187 size_t numBounded = 0;
188 for (
size_t j = 0; j < numPoints; j++) {
189 if (m_planes[i].isPointBounded(vertexes + j * m_nd)) {
220 bool lookForFullyContained =
true;
224 for (
size_t i = 0; i < m_numPlanes; i++) {
225 size_t numBounded = 0;
226 for (
size_t j = 0; j < numPoints; j++) {
227 if (m_planes[i].isPointBounded(vertexes + j * m_nd)) {
231 if (!lookForFullyContained)
236 lookForFullyContained =
false;
244 if (numBounded != numPoints)
245 lookForFullyContained =
false;
249 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,...