Template Class Vector3

Class Documentation

template <typename T>
class Vector3

Template class for 3-vectors of type float, double, …

Allows accessing and changing the elements x, y, z directly or through the corresponding get and set methods.

Angle definitions are phi [-pi, pi]: azimuthal angle in the x-y plane, 0 pointing in x-direction theta [0, pi]: zenith angle towards the z axis, 0 pointing in z-direction

Public Functions

Vector3(const Vector3 &v)
template <typename U>
Vector3(const Vector3<U> &v)
Vector3(const double *v)
Vector3(const float *v)
Vector3(const T &X, const T &Y, const T &Z)
Vector3(T t)
void setX(const T X)
void setY(const T Y)
void setZ(const T Z)
void setXYZ(const T X, const T Y, const T Z)
void setR(const T r)
void setRThetaPhi(const T r, const T theta, const T phi)
T getX() const
T getY() const
T getZ() const
T getR() const
T getR2() const
T getPhi() const
T getTheta() const
Vector3<T> getUnitVector() const
Vector3<T> getUnitVectorTheta() const
Vector3<T> getUnitVectorPhi() const
T getAngleTo(const Vector3<T> &v) const
bool isParallelTo(const Vector3<T> &v, T maxAngle) const
T getDistanceTo(const Vector3<T> &point) const
Vector3<T> getParallelTo(const Vector3<T> &v) const
Vector3<T> getPerpendicularTo(const Vector3<T> &v) const
Vector3<T> getRotated(const Vector3<T> &axis, T angle) const
Vector3<T> clip(T lower, T upper) const
Vector3<T> abs() const
Vector3<T> floor() const
Vector3<T> ceil() const
T min() const
T max() const
T dot(const Vector3<T> &v) const
Vector3<T> cross(const Vector3<T> &v) const
bool operator==(const Vector3<T> &v) const
Vector3<T> operator+(const Vector3<T> &v) const
Vector3<T> operator+(const T &f) const
Vector3<T> operator-(const Vector3<T> &v) const
Vector3<T> operator-(const T &f) const
Vector3<T> operator*(const Vector3<T> &v) const
Vector3<T> operator*(T v) const
Vector3<T> operator/(const Vector3<T> &v) const
Vector3<T> operator/(const T &f) const
Vector3<T> operator%(const Vector3<T> &v) const
Vector3<T> operator%(const T &f) const
Vector3<T> &operator-=(const Vector3<T> &v)
Vector3<T> &operator-=(const T &f)
Vector3<T> &operator+=(const Vector3<T> &v)
Vector3<T> &operator+=(const T &f)
Vector3<T> &operator*=(const Vector3<T> &v)
Vector3<T> &operator*=(const T &f)
Vector3<T> &operator/=(const Vector3<T> &v)
Vector3<T> &operator/=(const T &f)
Vector3<T> &operator%=(const Vector3<T> &v)
Vector3<T> &operator%=(const T &f)
Vector3<T> &operator=(const Vector3<T> &v)
Vector3<T> &operator=(const T &f)

Public Members

T x
T y
T z
T data[3]
union crpropa::Vector3::@4 @5