BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Three-dimensional vector template, for use with integer, double, or complex components. More...
Public Member Functions | |
BasicVector3D () | |
Constructs the null vector. | |
BasicVector3D (const T x1, const T y1, const T z1) | |
Constructs a vector from cartesian components. | |
double | angle (const BasicVector3D< T > &v) const |
Returns dot product of vectors (antilinear in the first [=self] argument). More... | |
BasicVector3D< complex_t > | complex () const |
Returns this, trivially converted to complex type. | |
BasicVector3D< T > | conj () const |
Multiplies this with a scalar, and returns result. More... | |
double | cosTheta () const |
Returns cosine of polar angle. | |
double | mag () const |
Returns magnitude of the vector. | |
double | mag2 () const |
Returns magnitude squared of the vector. | |
double | magxy () const |
Returns distance from z axis. | |
double | magxy2 () const |
Returns squared distance from z axis. | |
BasicVector3D< T > & | operator+= (const BasicVector3D< T > &v) |
Adds other vector to this, and returns result. | |
BasicVector3D< T > & | operator-= (const BasicVector3D< T > &v) |
Subtracts other vector from this, and returns result. | |
T & | operator[] (int i) |
Sets components by index. | |
T | operator[] (int i) const |
Returns components by index. | |
double | phi () const |
Returns azimuth angle. | |
BasicVector3D< T > | project (const BasicVector3D< T > &v) const |
Returns projection of this onto other vector: (this*v)*v/|v|^2. | |
BasicVector3D< double > | real () const |
Returns real parts. | |
BasicVector3D< T > | rotated (double a, const BasicVector3D< T > &v) const |
Returns result of rotation around the axis specified by another vector. | |
BasicVector3D< T > | rotatedX (double a) const |
Returns result of rotation around x-axis. | |
BasicVector3D< T > | rotatedY (double a) const |
Returns result of rotation around y-axis. | |
BasicVector3D< T > | rotatedZ (double a) const |
Returns result of rotation around z-axis. | |
void | setX (const T &a) |
Sets x-component in cartesian coordinate system. | |
void | setY (const T &a) |
Sets y-component in cartesian coordinate system. | |
void | setZ (const T &a) |
Sets z-component in cartesian coordinate system. | |
double | sin2Theta () const |
Returns squared sine of polar angle. | |
double | theta () const |
Returns polar angle. | |
BasicVector3D< T > | unit () const |
Returns unit vector in direction of this. Throws for null vector. | |
T | x () const |
Returns x-component in cartesian coordinate system. | |
T | y () const |
Returns y-component in cartesian coordinate system. | |
T | z () const |
Returns z-component in cartesian coordinate system. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class T > | |
bool | operator!= (const BasicVector3D< T > &a, const BasicVector3D< T > &b) |
Comparison of two vectors for inequality. | |
template<class T > | |
BasicVector3D< T > | operator+ (const BasicVector3D< T > &a, const BasicVector3D< T > &b) |
Addition of two vectors. | |
template<class T > | |
BasicVector3D< T > | operator+ (const BasicVector3D< T > &v) |
Unary plus. | |
template<class T > | |
BasicVector3D< T > | operator- (const BasicVector3D< T > &a, const BasicVector3D< T > &b) |
Subtraction of two vectors. | |
template<class T > | |
BasicVector3D< T > | operator- (const BasicVector3D< T > &v) |
Unary minus. | |
template<class T , class U > | |
BasicVector3D< T > | operator/ (const BasicVector3D< T > &v, U a) |
Multiplication vector by scalar. More... | |
template<class T > | |
std::ostream & | operator<< (std::ostream &os, const BasicVector3D< T > &a) |
Output to stream. | |
template<class T > | |
bool | operator== (const BasicVector3D< T > &a, const BasicVector3D< T > &b) |
Comparison of two vectors for equality. | |
Three-dimensional vector template, for use with integer, double, or complex components.
double BasicVector3D< T >::angle | ( | const BasicVector3D< T > & | v | ) | const |
Returns dot product of vectors (antilinear in the first [=self] argument).
Returns cross product of vectors (linear in both arguments). Returns angle with respect to another vector.
BasicVector3D<T> BasicVector3D< T >::conj | ( | ) | const |
Multiplies this with a scalar, and returns result.
Divides this by a scalar, and returns result. Returns complex conjugate vector
|
related |
Multiplication vector by scalar.
Multiplication scalar by vector. Division vector by scalar.