12#include "MantidKernel/DllConfig.h"
29class MANTID_KERNEL_DLL
V2D {
34 inline V2D() noexcept : m_pt{{0.0, 0.0}} {}
38 inline V2D(
double x,
double y) noexcept : m_pt{{
x,
y}} {}
44 inline double X()
const {
return m_pt[0]; }
49 inline double Y()
const {
return m_pt[1]; }
55 inline double &
X() {
return m_pt[0]; }
60 inline double &
Y() {
return m_pt[1]; }
104 return (std::fabs(
X() -
rhs.X()) < std::numeric_limits<double>::epsilon() &&
105 std::fabs(
Y() -
rhs.Y()) < std::numeric_limits<double>::epsilon());
121 inline double norm()
const {
return std::sqrt(norm2()); }
127 inline double norm2()
const {
return X() *
X() +
Y() *
Y(); }
133 inline double scalar_prod(
const V2D &other)
const {
return X() * other.X() +
Y() * other.Y(); }
148 double angle(
const V2D &other)
const;
156MANTID_KERNEL_DLL std::ostream &
operator<<(std::ostream &,
const V2D &);
const std::vector< double > & rhs
std::map< DeltaEMode::Type, std::string > index
Implements a 2-dimensional vector embedded in a 3D space, i.e.
std::array< double, 2 > m_pt
double Y() const
Y position.
V2D operator*(const double factor) const
Scale and return.
bool operator!=(const V2D &rhs) const
Inequality operator including a tolerance.
double & X()
X position (non-const reference)
V2D & operator-=(const V2D &rhs)
Decrement this by rhs.
bool operator==(const V2D &rhs) const
Equality operator including a tolerance.
V2D(double x, double y) noexcept
Constructor taking an x and y value.
double distance(const V2D &other) const
Distance (R) between two points defined as vectors.
V2D operator+(const V2D &rhs) const
V2D & operator*=(const double factor)
Scale this.
V2D operator-(const V2D &rhs) const
Subtract rhs.
V2D & operator+=(const V2D &rhs)
Increment this vector by rhs.
double & Y()
Y position (non-const)
double scalar_prod(const V2D &other) const
Compute the scalar product with another vector.
const double & operator[](const size_t index) const
Unchecked index access.
double X() const
X position.
double norm2() const
Compute the square of the norm.
V2D operator-() const noexcept
Negate.
V2D() noexcept
Default constructor.
V3D cross_prod(const V2D &other) const
Cross product.
double norm() const
Compute the norm.
MANTID_KERNEL_DLL std::ostream & operator<<(std::ostream &, CPUTimer &)
Convenience function to provide for easier debug printing.
MANTID_KERNEL_DLL V3D normalize(V3D v)
Normalizes a V3D.
Helper class which provides the Collimation Length for SANS instruments.