29 -k * std::cos(_alpha) * std::sin(_phi), k * std::sin(_alpha));
50 return x() == 0.0 &&
y() == 0.0 ? 0.0 : std::atan2(-
y(),
x());
56 return x() == 0.0 &&
y() == 0.0 &&
z() == 0.0 ? 0.0 : std::atan2(
magxy(),
z());
62 return mag() == 0 ? 1 :
z() /
mag();
113 double ptot =
mag() * v.
mag();
115 cosa =
dot(v) / ptot;
121 return std::acos(cosa);
BasicVector3D< double > vecOfLambdaAlphaPhi(double _lambda, double _alpha, double _phi)
Creates a vector<double> as a wavevector with given wavelength and angles.
std::complex< double > complex_t
Declares and partly implements template class BasicVector3D.
Defines many exception classes in namespace Exceptionss.
Defines M_PI and some more mathematical constants.
double mag2() const
Returns magnitude squared of the vector.
BasicVector3D< T > conj() const
Returns complex conjugate vector.
auto dot(const BasicVector3D< U > &v) const
Returns dot product of vectors (antilinear in the first [=self] argument).
double sin2Theta() const
Returns squared sine of polar angle.
BasicVector3D< T > unit() const
Returns unit vector in direction of this. Throws for null vector.
double magxy2() const
Returns squared distance from z axis.
double mag() const
Returns magnitude of the vector.
double theta() const
Returns polar angle.
BasicVector3D< double > real() const
Returns real parts.
T z() const
Returns z-component in cartesian coordinate system.
T y() const
Returns y-component in cartesian coordinate system.
double phi() const
Returns azimuth angle.
T x() const
Returns x-component in cartesian coordinate system.
double magxy() const
Returns distance from z axis.
double angle(const BasicVector3D< T > &v) const
Returns angle with respect to another vector.
BasicVector3D< std::complex< double > > complex() const
Returns this, trivially converted to complex type.
double cosTheta() const
Returns cosine of polar angle.