Go to the documentation of this file.
   19 #include <type_traits> 
   24 inline float operator*(
const Vec3D left, 
const Vec3D right);
 
   35   friend inline std::ostream &
operator<<(std::ostream &os, 
const Vec3D &vec);
 
   43       : 
CooArray<float>(std::numeric_limits<float>::max(), std::numeric_limits<float>::max(),
 
   44                         std::numeric_limits<float>::max()) {}
 
   51   constexpr 
Vec3D(
float x, 
float y, 
float z) : 
CooArray<float>(x, y, z) {}
 
   58   constexpr 
Vec3D(std::array<float, 3> arr) : 
CooArray(std::forward<std::array<float, 3>>(arr)) {}
 
   87       (*this) /= this->
Mag();
 
   92       (*this) /= this->
Mag();
 
   97       (*this) /= this->
Mag();
 
  102       (*this) /= this->
Mag();
 
  111   void Dump()
 const { std::cout << *
this << std::endl; }
 
  118   [[nodiscard]] 
float Mag()
 const { 
return std::sqrt((*
this) * (*
this)); }
 
  125     Vec3D result = *
this;
 
  126     return result /= 
Mag();
 
  141     Vec3D product(a, b, c);
 
  167     if (
PolarAngle() == 0.0f || std::fabs(
PolarAngle() - M_PI) < std::numeric_limits<float>::epsilon())
 
  168       throw UndefinedAngle(
"Vec3D::AzimuthAngle is undefined when polar == 0 or pi");
 
  229   template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  238   template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  253   template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  262   template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  295   return std::move(right);
 
  304 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  311 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  322 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  329 template <typename T, typename std::enable_if<std::is_arithmetic<T>::value>::type * = 
nullptr>
 
  
float Mag() const
Compute the vector magnitude.
Definition: Vec3D.h:118
 
Vec3D & operator+=(Vec3D const &right)
Add a vector to this one.
Definition: Vec3D.h:176
 
float operator*(const Vec3D left, const Vec3D right)
Compute the dot-product between two vectors.
Definition: Vec3D.h:338
 
A class describing a vector in 3D space.
Definition: Vec3D.h:33
 
void Dump() const
Dumps the vector components.
Definition: Vec3D.h:111
 
An array that accepts coordinates as subscripts.
Definition: CooArray.h:22
 
constexpr Vec3D(RefFrame::Direction direction)
Constructs a 3D vector from a given direction.
Definition: Vec3D.h:64
 
constexpr Vec3D()
Default constructor.
Definition: Vec3D.h:42
 
Vec3D & operator/=(T &&right)
Definition: Vec3D.h:263
 
float AzimuthAngle() const
Compute the azimuth angle.
Definition: Vec3D.h:166
 
Vec3D & operator-=(Vec3D &&right)
Definition: Vec3D.h:215
 
Direction
Aliases for the six axis directions.
Definition: RefFrame.h:55
 
Exception(std::string msg="")
Definition: Exception.h:30
 
CssGeoParams.h CssGeoParams class declaration.
Definition: CaloPDCalibrationAlgo.h:22
 
std::ostream & operator<<(std::ostream &os, const Vec3D &vec)
Write coordinates to stream.
Definition: Vec3D.h:345
 
friend std::ostream & operator<<(std::ostream &os, const Vec3D &vec)
Write coordinates to stream.
Definition: Vec3D.h:345
 
constexpr Vec3D CrossProduct(const Vec3D &rhs) const
Compute the cross product of two vectors.
Definition: Vec3D.h:137
 
float PolarAngle() const
Compute the polar angle.
Definition: Vec3D.h:156
 
Exception class for invalid operations on a undefined angle.
Definition: Vec3D.h:146
 
Vec3D & operator*=(T &&right)
Definition: Vec3D.h:239
 
bool operator==(const Vec3D &right) const
Comparison operator.
Definition: Vec3D.h:276
 
constexpr Vec3D(float x, float y, float z)
Constructor.
Definition: Vec3D.h:51
 
Vec3D & operator-=(Vec3D const &right)
Subtract a vector from this one.
Definition: Vec3D.h:208
 
Definition: Exception.h:24
 
Vec3D & operator*=(T const &right)
Multiply a vector by a number.
Definition: Vec3D.h:230
 
Vec3D UnitVector() const
Return this vector, but normalized to unit length.
Definition: Vec3D.h:124
 
Vec3D operator/(Vec3D left, T const &right)
Divide a vector by a number.
Definition: Vec3D.h:323
 
Vec3D & operator/=(T const &right)
Divide a vector by a number.
Definition: Vec3D.h:254
 
constexpr Vec3D(std::array< float, 3 > arr)
Constructor.
Definition: Vec3D.h:58
 
Vec3D & operator+=(Vec3D &&right)
Definition: Vec3D.h:183
 
Vec3D operator+(Vec3D left, Vec3D const &right)
Add two vectors.
Definition: Vec3D.h:289
 
Vec3D operator-(Vec3D const &right) const
Subtract two vectors.
Definition: Vec3D.h:195