|
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. | |
| V3D | cross_prod (const V2D &other) const |
| Cross product. | |
| double | distance (const V2D &other) const |
| Distance (R) between two points defined as vectors. | |
| double | norm () const |
| Compute the norm. | |
| double | norm2 () const |
| Compute the square of the norm. | |
| double | normalize () |
| Make a normalized vector (return norm value) | |
| const double & | operator[] (const size_t index) const |
| Unchecked index access. | |
| double | scalar_prod (const V2D &other) const |
| Compute the scalar product with another vector. | |
| V2D () noexcept | |
| Default constructor. | |
| V2D (double x, double y) noexcept | |
| Constructor taking an x and y value. | |
| double & | X () |
| X position (non-const reference) | |
| double | X () const |
| X position. | |
| double & | Y () |
| Y position (non-const) | |
| double | Y () const |
| Y position. | |
Arithmetic operations | |
Sum this and the rhs | |
| V2D | operator+ (const V2D &rhs) const |
| V2D & | operator+= (const V2D &rhs) |
| Increment this vector by rhs. | |
| V2D | operator- (const V2D &rhs) const |
| Subtract rhs. | |
| V2D & | operator-= (const V2D &rhs) |
| Decrement this by rhs. | |
| V2D | operator* (const double factor) const |
| Scale and return. | |
| V2D & | operator*= (const double factor) |
| Scale this. | |
| V2D | operator/ (const double d) const noexcept |
| Divide by d. | |
| V2D & | operator/= (const double d) |
| V2D | operator- () const noexcept |
| Negate. | |
Comparison operators | |
| bool | operator== (const V2D &rhs) const |
| Equality operator including a tolerance. | |
| bool | operator!= (const V2D &rhs) const |
| Inequality operator including a tolerance. | |
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().
|
inline |
|
inline |
Compute the norm.
Definition at line 128 of file V2D.h.
Referenced by angle(), Mantid::Geometry::classify(), Mantid::Geometry::crossingPoint(), distance(), and normalize().
|
inline |
| double Mantid::Kernel::V2D::normalize | ( | ) |
|
inline |
|
inline |
|
inline |
|
inlinenoexcept |
|
inlinenoexcept |
|
inline |
Definition at line 93 of file V2D.h.
References Mantid::Geometry::d.
|
inline |
|
inline |
|
inline |
Compute the scalar product with another vector.
| other | :: A second vector |
Definition at line 140 of file V2D.h.
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().