Mantid
|
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions. More...
#include <MDImplicitFunction.h>
Public Types | |
enum | eContact { NOT_TOUCHING = 0 , TOUCHING = 1 , CONTAINED = 2 } |
Enum for describing the contact between a box and an implicit function. More... | |
Public Member Functions | |
void | addPlane (const MDPlane &plane) |
Add a bounded plane to this implicit function. More... | |
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. More... | |
virtual std::string | getName () const |
size_t | getNumDims () const |
size_t | getNumPlanes () 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. More... | |
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? More... | |
virtual bool | isPointContained (const coord_t *coords) |
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes contained, then this returns true. More... | |
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 contained, then this returns true. More... | |
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 contained, then this returns true. More... | |
MDImplicitFunction () | |
Constructor. More... | |
virtual std::string | toXMLString () const |
virtual | ~MDImplicitFunction ()=default |
Protected Attributes | |
size_t | m_nd |
number of dimensions for which this object can be applied More... | |
size_t | m_numPlanes |
Cached number of planes (for a sligh speed-up) More... | |
std::vector< MDPlane > | m_planes |
Vector of all the planes applying for this implict function. More... | |
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
This is to be used in various MD rebinning algorithms to determine e.g, which boxes should be considered to be within the integration volume.
This general case would cover boxes that are not aligned with the axes.
Various shapes can be built by intersecting 1 or more planes. The Plane, and whether a point is bounded by it, will be the basis of determining whether a point is in a volume.
For example, in a 3D space:
1 plane = a half-infinite volume 2 parallel planes = a plane with a thickness 4 aligned planes = an infinite line, rectangular in cross-section 6 planes = a cuboid
For most efficiency, each MDImplicitFunction should be built with a given set of dimensions in mind; that is, if it is to be applied on a MDEventWorkspace with say 6 dimensions: X, Y, Z, time, temperature, field; then a mask that only looks at the relevant 3 dimensions is used.
Definition at line 44 of file MDImplicitFunction.h.
Enum for describing the contact between a box and an implicit function.
Enumerator | |
---|---|
NOT_TOUCHING | No part of the box touches the implicit function. |
TOUCHING | Box is partly touching the implicit function region. |
CONTAINED | Box is fully contained by the implicit function. |
Definition at line 75 of file MDImplicitFunction.h.
Mantid::Geometry::MDImplicitFunction::MDImplicitFunction | ( | ) |
Constructor.
Definition at line 15 of file MDImplicitFunction.cpp.
|
virtualdefault |
void Mantid::Geometry::MDImplicitFunction::addPlane | ( | const MDPlane & | plane | ) |
Add a bounded plane to this implicit function.
plane | :: MDPlane to add. |
Definition at line 22 of file MDImplicitFunction.cpp.
References Mantid::Geometry::MDPlane::getNumDims(), m_nd, m_numPlanes, and m_planes.
Referenced by Mantid::Geometry::MDPlaneImplicitFunction::addPlane(), and Mantid::Geometry::MDBoxImplicitFunction::construct().
|
inline |
Determine how a box (consisting of a number of vertexes) is in contact with the implicit function.
Returns: NOT_TOUCHING : if any of the planes has no vertex in it. CONTAINED : if all of the vertexes are in all of the planes. TOUCHING : if there is a chance of the box touching the volume. (there can sometimes be false positives)
vertexes | :: bare array of length numPoints * m_nd |
numPoints | :: number of vertexes in the array. |
Definition at line 229 of file MDImplicitFunction.h.
|
inlinevirtual |
Reimplemented in Mantid::Geometry::CompositeImplicitFunction, Mantid::Geometry::MDPlaneImplicitFunction, and Mantid::Geometry::NullImplicitFunction.
Definition at line 62 of file MDImplicitFunction.h.
|
inline |
Definition at line 56 of file MDImplicitFunction.h.
Referenced by Mantid::Geometry::MDPlaneImplicitFunction::checkOrigin(), and Mantid::Geometry::MDPlaneImplicitFunction::coordValue().
|
inline |
Definition at line 59 of file MDImplicitFunction.h.
Referenced by Mantid::Geometry::MDPlaneImplicitFunction::addPlane().
|
inline |
index | :: which plane to return |
Definition at line 53 of file MDImplicitFunction.h.
References index.
Referenced by Mantid::Geometry::MDPlaneImplicitFunction::toXMLString().
|
inline |
Same as isBoxTouching(vector), except that it takes a bare array of coordinates.
This is for max. performance.
The array is to be filled with numPoints sets of coordinates, each of m_nd in length.
vertexes | :: bare array of length numPoints * m_nd |
numPoints | :: number of vertexes in the array. |
Definition at line 195 of file MDImplicitFunction.h.
|
inline |
Is there a chance that the box defined by these vertexes touches the implicit function volume?
The algorithm operates by the idea that if any point in a volume is contained in the volume, then that means that at least one of the vertexes is within EACH one of the planes that define the volume.
That means that if you find a plane for which NO vertex is contained, then the box defined by these vertexes CANNOT touch any part of the volume so it is safe to ignore. (I don't have a rigorous proof for this but it looks right :)
There are situations where the condition can be satisfied but the box does not actually touch the volume (false positives) but these should be pretty rare.
vertexes | :: vector of n-dimensional coordinate vertexes. NOTE: no size check is done! Each vertex must be length m_nd! |
Definition at line 161 of file MDImplicitFunction.h.
|
inlinevirtual |
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes contained, then this returns true.
coords | :: nd-sized array of coordinates |
Reimplemented in Mantid::Geometry::NullImplicitFunction, Mantid::Geometry::CompositeImplicitFunction, Mantid::Geometry::NullImplicitFunction, Mantid::Geometry::MDAlgorithms::MDBoxMaskFunction, Mantid::Geometry::CompositeImplicitFunction, and Mantid::Geometry::MDAlgorithms::MDBoxMaskFunction.
Definition at line 94 of file MDImplicitFunction.h.
Referenced by Mantid::DataObjects::MDHistoWorkspace::applyImplicitFunction(), and Mantid::API::MatrixWorkspaceMDIterator::next().
|
inlinevirtual |
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes contained, then this returns true.
coords | :: nd-sized array of coordinates |
Reimplemented in Mantid::Geometry::CompositeImplicitFunction, Mantid::Geometry::NullImplicitFunction, and Mantid::Geometry::MDAlgorithms::MDBoxMaskFunction.
Definition at line 110 of file MDImplicitFunction.h.
|
inlinevirtual |
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes contained, then this returns true.
coords | :: nd-sized vector of coordinates. No size-check is made! |
Reimplemented in Mantid::Geometry::NullImplicitFunction, Mantid::Geometry::CompositeImplicitFunction, Mantid::Geometry::NullImplicitFunction, Mantid::Geometry::MDAlgorithms::MDBoxMaskFunction, and Mantid::Geometry::CompositeImplicitFunction.
Definition at line 126 of file MDImplicitFunction.h.
|
inlinevirtual |
Reimplemented in Mantid::Geometry::CompositeImplicitFunction, Mantid::Geometry::MDPlaneImplicitFunction, and Mantid::Geometry::NullImplicitFunction.
Definition at line 67 of file MDImplicitFunction.h.
|
protected |
number of dimensions for which this object can be applied
Definition at line 269 of file MDImplicitFunction.h.
Referenced by addPlane().
|
protected |
Cached number of planes (for a sligh speed-up)
Definition at line 275 of file MDImplicitFunction.h.
Referenced by addPlane().
|
protected |
Vector of all the planes applying for this implict function.
Definition at line 272 of file MDImplicitFunction.h.
Referenced by addPlane().