42 auto manditoryExtents = std::make_shared<Mantid::Kernel::MandatoryValidator<std::vector<double>>>();
45 "A comma separated list of cartesian coordinates for the "
46 "lower left vertex of the surface. Values to be specified in "
47 "the CoordinateFrame choosen.");
50 "A comma separated list of cartesian coordinates for the "
51 "upper left vertex of the surface. Values to be specified in "
52 "the CoordinateFrame choosen.");
55 "A comma separated list of cartesian coordinates for the "
56 "upper right vertex of the surface. Values to be specified "
57 "in the CoordinateFrame choosen.");
60 std::make_unique<
ArrayProperty<double>>(
"Vertex4", std::vector<double>(), std::move(manditoryExtents)),
61 "A comma separated list of cartesian coordinates for the "
62 "lower right vertex of the surface. Values to be specified "
63 "in the CoordinateFrame choosen.");
76 throw std::invalid_argument(
"Input vertexes are not coplanar.");
81 if (b.
norm2() !=
d.norm2()) {
82 throw std::invalid_argument(
"Defined surface is not square sided.");
96 V3D closestPointOnSegment;
101 }
else if (proj >= line.
norm())
105 closestPointOnSegment =
lineStart + line;
109 V3D projectionVector = unitLine * proj;
110 closestPointOnSegment = projectionVector +
lineStart;
113 return (peakCenter - closestPointOnSegment).norm() <= peakRadius;
141 if (normal.
scalar_prod(touchPoint - faceVertex) != 0) {
142 throw std::runtime_error(
"Debugging. Calculation is wrong. touch point should always be on the "
178 if (vec.size() != 3) {
179 throw std::invalid_argument(
"All Vertex parameter arguments must have 3 entries.");
181 return V3D(vec[0], vec[1], vec[2]);
#define DECLARE_ALGORITHM(classname)
std::vector< double > VecDouble
void declareProperty(std::unique_ptr< Kernel::Property > p, const std::string &doc="") override
Add a property to the list of managed properties.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
void executePeaksIntersection(const bool checkPeakExtents=true)
Run the algorithm.
double getPeakRadius() const
Get the peak radius.
void initBaseProperties()
Initalize the common properties.
PeaksOnSurface : Check peak workspace interaction with a single surface.
Mantid::Kernel::V3D m_vertex1
Mantid::Kernel::V3D m_line1
void validateExtentsInput() const override
Validate the input extents.
int version() const override
Algorithm's version for identification.
std::vector< double > m_extents
Extents.
Mantid::Kernel::V3D m_vertex3
bool pointOutsideAnyExtents(const Mantid::Kernel::V3D &testPoint) const override
Check that a point is outside any of the extents.
Mantid::Kernel::V3D m_vertex2
const std::string category() const override
Algorithm's category for identification.
bool pointInsideAllExtents(const Mantid::Kernel::V3D &testPoint, const Mantid::Kernel::V3D &peakCenter) const override
Check that a point is inside ALL of the extents.
const std::string name() const override
Algorithm's name for identification.
void checkTouchPoint(const Mantid::Kernel::V3D &touchPoint, const Mantid::Kernel::V3D &normal, const Mantid::Kernel::V3D &faceVertex) const override
Verfifies that the normals have been set up correctly such that the touch point falls onto the plane.
VecVecV3D createFaces() const override
Create the faces associated with this shape.
Mantid::Kernel::V3D m_vertex4
int numberOfFaces() const override
Implementation of pure virtual method on PeaksIntersection.
Mantid::Kernel::V3D m_line2
void exec() override
Execute the algorithm.
Mantid::Kernel::V3D m_line3
void init() override
Initialize the algorithm's properties.
Mantid::Kernel::V3D m_line4
Support for a property that holds an array of values.
constexpr double scalar_prod(const V3D &v) const noexcept
Calculates the cross product.
constexpr double X() const noexcept
Get x.
constexpr V3D cross_prod(const V3D &v) const noexcept
Cross product (this * argument)
constexpr double Y() const noexcept
Get y.
double norm() const noexcept
constexpr double norm2() const noexcept
Vector length squared.
constexpr double Z() const noexcept
Get z.
std::vector< VecV3D > VecVecV3D
V3D makeV3DFromVector(const VecDouble &vec)
bool MANTID_CRYSTAL_DLL lineIntersectsSphere(const Mantid::Kernel::V3D &line, const Mantid::Kernel::V3D &lineStart, const Mantid::Kernel::V3D &peakCenter, const double peakRadius)
Non-member helper function.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.