BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Three-dimensional vector class, templated on base type.
Base type T can be int, double, or complex<double>. The resulting classes shall be abbreviated I3, R3, C3.
Public Member Functions | |
Vec3 () | |
Constructs the null vector. More... | |
Vec3 (const T x_, const T y_, const T z_) | |
Constructs a vector from cartesian components. More... | |
C3 | complex () const |
Returns this, trivially converted to complex type. More... | |
Vec3< T > | conj () const |
Returns complex conjugate vector. More... | |
double | mag () const |
Returns magnitude of the vector. More... | |
double | mag2 () const |
Returns magnitude squared of the vector. More... | |
double | magxy () const |
Returns distance from z axis. More... | |
double | magxy2 () const |
Returns squared distance from z axis. More... | |
bool | operator!= (const Vec3< T > &other) const |
Vec3< T > & | operator+= (const Vec3< T > &v) |
Adds other vector to this, and returns result. More... | |
Vec3< T > & | operator-= (const Vec3< T > &v) |
Subtracts other vector from this, and returns result. More... | |
bool | operator== (const Vec3< T > &other) const |
R3 | real () const |
Returns real parts. More... | |
Vec3< T > | rotatedY (double a) const |
Returns result of rotation around y-axis. More... | |
Vec3< T > | rotatedZ (double a) const |
Returns result of rotation around z-axis. More... | |
void | setX (const T &a) |
Sets x-component in cartesian coordinate system. More... | |
void | setY (const T &a) |
Sets y-component in cartesian coordinate system. More... | |
void | setZ (const T &a) |
Sets z-component in cartesian coordinate system. More... | |
Vec3< T > | unit () const |
Returns unit vector in direction of this. Throws for null vector. More... | |
T | x () const |
Returns x-component in cartesian coordinate system. More... | |
T | y () const |
Returns y-component in cartesian coordinate system. More... | |
T | z () const |
Returns z-component in cartesian coordinate system. More... | |
Constructs a vector from cartesian components.
Returns this, trivially converted to complex type.
double Vec3< T >::mag | ( | ) | const |
Returns magnitude of the vector.
double Vec3< T >::mag2 | ( | ) | const |
Returns magnitude squared of the vector.
double Vec3< T >::magxy | ( | ) | const |
Returns distance from z axis.
double Vec3< T >::magxy2 | ( | ) | const |
Returns squared distance from z axis.
Adds other vector to this, and returns result.
Subtracts other vector from this, and returns result.
Returns result of rotation around y-axis.
Returns result of rotation around z-axis.
void Vec3< T >::setX | ( | const T & | a | ) |
Sets x-component in cartesian coordinate system.
void Vec3< T >::setY | ( | const T & | a | ) |
Sets y-component in cartesian coordinate system.
void Vec3< T >::setZ | ( | const T & | a | ) |
Sets z-component in cartesian coordinate system.
Returns unit vector in direction of this. Throws for null vector.
T Vec3< T >::x | ( | ) | const |
Returns x-component in cartesian coordinate system.
T Vec3< T >::y | ( | ) | const |
Returns y-component in cartesian coordinate system.
T Vec3< T >::z | ( | ) | const |
Returns z-component in cartesian coordinate system.