BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
BasicVector3D< T > Class Template Reference

Forked from CLHEP/Geometry by E. More...

Public Member Functions

 BasicVector3D ()
 Default constructor.
 
 BasicVector3D (const T x1, const T y1, const T z1)
 Constructor from cartesian components.
 
operator[] (int i) const
 Returns components by index.
 
T & operator[] (int i)
 Sets components by index.
 
x () const
 Returns x-component in cartesian coordinate system.
 
y () const
 Returns y-component in cartesian coordinate system.
 
z () const
 Returns z-component in cartesian coordinate system.
 
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.
 
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.
 
template<class U >
auto operator*= (U a)
 Multiplies this with a scalar, and returns result.
 
template<class U >
auto operator/= (U a)
 Divides this by a scalar, and returns result.
 
BasicVector3D< T > conj () const
 Returns complex conjugate vector.
 
double mag2 () const
 Returns magnitude squared of the vector.
 
double mag () const
 Returns magnitude of the vector.
 
double magxy2 () const
 Returns squared distance from z axis.
 
double magxy () const
 Returns distance from z axis.
 
double phi () const
 Returns azimuth angle.
 
double theta () const
 Returns polar angle.
 
double cosTheta () const
 Returns cosine of polar angle.
 
double sin2Theta () const
 Returns squared sine of polar angle.
 
BasicVector3D< T > unit () const
 Returns unit vector in direction of this. Throws for null vector.
 
BasicVector3D< std::complex< double > > complex () const
 Returns this, trivially converted to complex type.
 
BasicVector3D< double > real () const
 Returns real parts.
 
template<class U >
auto dot (const BasicVector3D< U > &v) const
 Returns dot product of vectors (antilinear in the first [=self] argument). More...
 
template<class U >
auto cross (const BasicVector3D< U > &v) const
 Returns cross product of vectors (linear in both arguments). More...
 
double angle (const BasicVector3D< T > &v) const
 Returns angle with respect to another vector.
 
BasicVector3D< T > project (const BasicVector3D< T > &v) const
 Returns projection of this onto other vector: (this*v)*v/|v|^2.
 
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.
 
BasicVector3D< T > rotated (double a, const BasicVector3D< T > &v) const
 Returns result of rotation around the axis specified by another vector.
 
BasicVector3D< complex_t > conj () const
 
BasicVector3D< double > real () const
 
BasicVector3D< complex_t > unit () const
 

Related Functions

(Note that these are not member functions.)

template<class T >
std::ostream & operator<< (std::ostream &os, const BasicVector3D< T > &a)
 Output to stream.
 
template<class T >
BasicVector3D< T > operator+ (const BasicVector3D< T > &v)
 Unary plus.
 
template<class T >
BasicVector3D< T > operator- (const BasicVector3D< T > &v)
 Unary minus.
 
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 > &a, const BasicVector3D< T > &b)
 Subtraction of two vectors.
 
template<class T , class U >
auto operator* (const BasicVector3D< T > &v, const U a)
 Multiplication vector by scalar.
 
template<class T , class U >
auto operator* (const U a, const BasicVector3D< T > &v)
 Multiplication scalar by vector.
 
template<class T , class U >
BasicVector3D< T > operator/ (const BasicVector3D< T > &v, U a)
 Division vector by scalar.
 
template<class T >
bool operator== (const BasicVector3D< T > &a, const BasicVector3D< T > &b)
 Comparison of two vectors for equality.
 
template<class T >
bool operator!= (const BasicVector3D< T > &a, const BasicVector3D< T > &b)
 Comparison of two vectors for inequality.
 

Detailed Description

template<class T>
class BasicVector3D< T >

Forked from CLHEP/Geometry by E.

Chernyaev Evgue.nosp@m.ni.T.nosp@m.chern.nosp@m.iaev.nosp@m.@cern.nosp@m..ch, then reworked beyond recognition. Removed split of point and vector semantics. Transforms are relegated to a separate class Transform3D. Three-dimensional vector template, for use with integer, double, or complex components.

Definition at line 27 of file BasicVector3D.h.

Member Function Documentation

◆ dot()

template<class T >
template<class U >
auto BasicVector3D< T >::dot ( const BasicVector3D< U > &  v) const
inline

Returns dot product of vectors (antilinear in the first [=self] argument).

Returns dot product of (complex) vectors (antilinear in the first [=self] argument).

Definition at line 310 of file BasicVector3D.h.

◆ cross()

template<class T >
template<class U >
auto BasicVector3D< T >::cross ( const BasicVector3D< U > &  v) const
inline

Returns cross product of vectors (linear in both arguments).

Returns cross product of (complex) vectors.

Definition at line 321 of file BasicVector3D.h.


The documentation for this class was generated from the following file: