Mantid
|
Implements a 2-dimensional vector embedded in a 3D space, i.e. More...
#include <V2D.h>
Public Member Functions | |
double | angle (const V2D &other) const |
Angle between this and another vector. More... | |
V3D | cross_prod (const V2D &other) const |
Cross product. More... | |
double | distance (const V2D &other) const |
Distance (R) between two points defined as vectors. More... | |
double | norm () const |
Compute the norm. More... | |
double | norm2 () const |
Compute the square of the norm. More... | |
double | normalize () |
Make a normalized vector (return norm value) More... | |
const double & | operator[] (const size_t index) const |
Unchecked index access. More... | |
double | scalar_prod (const V2D &other) const |
Compute the scalar product with another vector. More... | |
V2D () noexcept | |
Default constructor. More... | |
V2D (double x, double y) noexcept | |
Constructor taking an x and y value. More... | |
double & | X () |
X position (non-const reference) More... | |
double | X () const |
X position. More... | |
double & | Y () |
Y position (non-const) More... | |
double | Y () const |
Y position. More... | |
Arithmetic operations | |
Sum this and the rhs | |
V2D | operator+ (const V2D &rhs) const |
V2D & | operator+= (const V2D &rhs) |
Increment this vector by rhs. More... | |
V2D | operator- (const V2D &rhs) const |
Subtract rhs. More... | |
V2D & | operator-= (const V2D &rhs) |
Decrement this by rhs. More... | |
V2D | operator* (const double factor) const |
Scale and return. More... | |
V2D & | operator*= (const double factor) |
Scale this. More... | |
V2D | operator- () const noexcept |
Negate. More... | |
Comparison operators | |
bool | operator== (const V2D &rhs) const |
Equality operator including a tolerance. More... | |
bool | operator!= (const V2D &rhs) const |
Inequality operator including a tolerance. More... | |
Private Attributes | |
std::array< double, 2 > | m_pt |
Implements a 2-dimensional vector embedded in a 3D space, i.e.
such that the cross product of two 2D vectors is a 3D vector in the Z direction
|
inlinenoexcept |
|
inlinenoexcept |
Constructor taking an x and y value.
Definition at line 38 of file V2D.h.
References Mantid::Geometry::x, and Mantid::Geometry::y.
double Mantid::Kernel::V2D::angle | ( | const V2D & | other | ) | const |
Angle between this and another vector.
Definition at line 32 of file V2D.cpp.
References norm(), and scalar_prod().
Cross product.
Definition at line 138 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inline |
Distance (R) between two points defined as vectors.
other | :: A second vector |
Definition at line 145 of file V2D.h.
References norm(), Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inline |
Compute the norm.
Definition at line 121 of file V2D.h.
Referenced by angle(), Mantid::Geometry::classify(), Mantid::Geometry::crossingPoint(), distance(), and normalize().
|
inline |
Compute the square of the norm.
Definition at line 127 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
double Mantid::Kernel::V2D::normalize | ( | ) |
|
inline |
|
inline |
Scale and return.
Definition at line 84 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inline |
Scale this.
Definition at line 86 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
Definition at line 68 of file V2D.h.
References rhs, Mantid::Geometry::X, and Mantid::Geometry::Y.
Increment this vector by rhs.
Definition at line 70 of file V2D.h.
References rhs, Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inlinenoexcept |
Negate.
Definition at line 92 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
Subtract rhs.
Definition at line 76 of file V2D.h.
References rhs, Mantid::Geometry::X, and Mantid::Geometry::Y.
Decrement this by rhs.
Definition at line 78 of file V2D.h.
References rhs, Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inline |
Equality operator including a tolerance.
rhs | :: The rhs object |
Definition at line 103 of file V2D.h.
References rhs, Mantid::Geometry::X, and Mantid::Geometry::Y.
|
inline |
|
inline |
Compute the scalar product with another vector.
other | :: A second vector |
Definition at line 133 of file V2D.h.
References Mantid::Geometry::X, and Mantid::Geometry::Y.
Referenced by angle(), and Mantid::Geometry::orientation().
|
inline |
|
inline |
X position.
Definition at line 44 of file V2D.h.
Referenced by Mantid::Geometry::Quadrilateral::area(), Mantid::DataObjects::FractionalRebinning::calcTrapezoidYIntersections(), Mantid::Geometry::classify(), Mantid::DataObjects::CalculateReflectometryKiKf::createQuad(), Mantid::DataObjects::CalculateReflectometryP::createQuad(), Mantid::DataObjects::CalculateReflectometryQxQz::createQuad(), Mantid::Geometry::ConvexPolygon::determinant(), Mantid::Geometry::edgeAimsAt(), Mantid::Geometry::ConvexPolygon::insert(), Mantid::Geometry::intersection(), normalize(), Mantid::Kernel::operator<<(), Mantid::Geometry::orientation(), and Mantid::Geometry::ConvexPolygon::triangleArea().
|
inline |
|
inline |
Y position.
Definition at line 49 of file V2D.h.
Referenced by Mantid::Geometry::Quadrilateral::area(), Mantid::DataObjects::FractionalRebinning::calcTrapezoidYIntersections(), Mantid::Geometry::classify(), Mantid::DataObjects::CalculateReflectometryKiKf::createQuad(), Mantid::DataObjects::CalculateReflectometryP::createQuad(), Mantid::DataObjects::CalculateReflectometryQxQz::createQuad(), Mantid::Geometry::ConvexPolygon::determinant(), Mantid::Geometry::ConvexPolygon::insert(), Mantid::Geometry::intersection(), normalize(), Mantid::Kernel::operator<<(), Mantid::Geometry::orientation(), and Mantid::Geometry::ConvexPolygon::triangleArea().