Mantid
Loading...
Searching...
No Matches
MDBoxMaskFunction.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//--------------------------------------------------------------------------------------------------
8// Includes
9//--------------------------------------------------------------------------------------------------
10#pragma once
11
13#include <MantidKernel/V3D.h>
14
17private:
20
21public:
22 // constructor
23 MDBoxMaskFunction(const Mantid::Kernel::V3D &pos, const double &radiusSquared)
24 : m_pos(pos), m_radiusSquared(radiusSquared) {}
25
26 using MDImplicitFunction::isPointContained; // Avoids Intel compiler
27 // warning.
28 bool isPointContained(const coord_t *coords) override {
29 double sum = 0;
30 for (size_t i = 0; i < 3; i++) {
31 sum += pow(coords[i] - m_pos[i], 2);
32 }
33 if (sum < m_radiusSquared) {
34 return true;
35 } else {
36 return false;
37 }
38 }
39};
40} // namespace Mantid::Geometry::MDAlgorithms
MDBoxMaskFunction(const Mantid::Kernel::V3D &pos, const double &radiusSquared)
bool isPointContained(const coord_t *coords) override
Is a point in MDimensions contained by this ImplicitFunction? If the point is bounded by ALL planes c...
An "ImplicitFunction" defining a hyper-cuboid-shaped region in N dimensions.
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...
Class for 3D vectors.
Definition: V3D.h:34
float coord_t
Typedef for the data type to use for coordinate axes in MD objects such as MDBox, MDEventWorkspace,...
Definition: MDTypes.h:27