|
qupid 0.2
Quasi-Signal Generation Model for Pixelized Detector
|
3-component double vector with hand-rolled operations. More...
#include <QPVector.hpp>
Public Member Functions | |
| QPVector () | |
| Zero vector. | |
| QPVector (double x, double y) | |
| 2D point; z is set to 0. | |
| QPVector (double x, double y, double z) | |
| QPVector (const QPVector &other) | |
| Copy constructor. | |
| double | X () |
| double | Y () |
| double | Z () |
| void | Get (double &x, double &y, double &z) |
| Writes the components into the given references. | |
| QPVector | Unit () |
| Unit vector | |
| double | Dot (QPVector other) const |
| Dot product | |
| QPVector | Cross (QPVector other) const |
| Cross product | |
| QPVector | Scale (double &number) |
| Scaled copy | |
| double | Norm () |
| double | Norm2 () |
| void | AddThis (const QPVector &other) |
| In-place add; delegates to operator+= and inherits its z-component defect (see operator+=). | |
| void | SubstractThis (const QPVector &other) |
| In-place subtract; delegates to operator-= and inherits its z-component defect (see operator-=). | |
| void | CrossThis (const QPVector &other) |
| In-place cross product; delegates to operator^= and inherits its overwrite defect (see operator^=). | |
| void | ScaleThis (const double &number) |
| Multiply all components in place. | |
| QPVector & | operator= (const QPVector &other) |
| Component-wise copy assignment. | |
| QPVector & | operator+= (const QPVector &other) |
| In-place add. | |
| QPVector & | operator-= (const QPVector &other) |
| In-place subtract. | |
| QPVector & | operator*= (const double &other) |
| Multiply all components in place. | |
| QPVector & | operator^= (const QPVector &other) |
| In-place cross product. | |
| double & | operator() (const int &i) |
| Reference to component i (0 = x, 1 = y, 2 = z). | |
| double & | operator[] (const int &i) |
| Reference to component i (0 = x, 1 = y, 2 = z); same behavior and warning as operator(). | |
| double | GetAngle (QPVector other) |
Angle between this vector and other, | |
| double | GetAngleDegree (QPVector other) |
| GetAngle converted to degrees. | |
| std::string | Print (bool quite=false) |
| Formats the vector as "[x,y,z]". | |
Friends | |
| QPVector | operator+ (QPVector &a, QPVector &b) |
| Component-wise sum (lvalue overload). | |
| QPVector | operator+ (QPVector a, QPVector b) |
| Component-wise sum. | |
| QPVector | operator- (QPVector a, QPVector b) |
| Component-wise difference. | |
| QPVector | operator^ (QPVector a, QPVector b) |
| Cross product | |
| QPVector | operator* (QPVector vec, double other) |
| Scaled copy. | |
| QPVector | operator* (double other, QPVector vec) |
| Scaled copy. | |
| double | operator* (QPVector other, QPVector vec) |
| Dot product. | |
3-component double vector with hand-rolled operations.
The 2-argument constructor sets z = 0, so the same type serves the 2D signal geometry.
Definition at line 13 of file QPVector.hpp.
| QPVector::QPVector | ( | ) |
Zero vector.
Definition at line 10 of file QPVector.cpp.
| QPVector::QPVector | ( | double | x, |
| double | y | ||
| ) |
2D point; z is set to 0.
| x | component x |
| y | component y |
Definition at line 11 of file QPVector.cpp.
| QPVector::QPVector | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
| x | component x |
| y | component y |
| z | component z |
Definition at line 12 of file QPVector.cpp.
| QPVector::QPVector | ( | const QPVector & | other | ) |
| double QPVector::X | ( | ) |
Definition at line 16 of file QPVector.cpp.
| double QPVector::Y | ( | ) |
Definition at line 17 of file QPVector.cpp.
| double QPVector::Z | ( | ) |
Definition at line 18 of file QPVector.cpp.
| void QPVector::Get | ( | double & | x, |
| double & | y, | ||
| double & | z | ||
| ) |
Writes the components into the given references.
| x | receives component x |
| y | receives component y |
| z | receives component z |
Definition at line 19 of file QPVector.cpp.
| QPVector QPVector::Unit | ( | ) |
Unit vector 
No zero-norm guard: a zero vector yields NaN components.
Definition at line 21 of file QPVector.cpp.
References Norm(), and QPVector().
Referenced by GetAngle().
|
inline |
Dot product 
| other | second operand |
Definition at line 248 of file QPVector.hpp.
Referenced by GetAngle().
Cross product 
| other | second operand |
Definition at line 252 of file QPVector.hpp.
References QPVector().
| QPVector QPVector::Scale | ( | double & | number | ) |
Scaled copy 
| number | scale factor k (historical non-const reference) |
Definition at line 28 of file QPVector.cpp.
References QPVector().
| double QPVector::Norm | ( | ) |
| double QPVector::Norm2 | ( | ) |

Definition at line 37 of file QPVector.cpp.
| void QPVector::AddThis | ( | const QPVector & | other | ) |
In-place add; delegates to operator+= and inherits its z-component defect (see operator+=).
| other | vector to add |
Definition at line 42 of file QPVector.cpp.
| void QPVector::SubstractThis | ( | const QPVector & | other | ) |
In-place subtract; delegates to operator-= and inherits its z-component defect (see operator-=).
| other | vector to subtract |
Definition at line 48 of file QPVector.cpp.
| void QPVector::CrossThis | ( | const QPVector & | other | ) |
In-place cross product; delegates to operator^= and inherits its overwrite defect (see operator^=).
| other | second operand |
Definition at line 54 of file QPVector.cpp.
| void QPVector::ScaleThis | ( | const double & | number | ) |
Multiply all components in place.
| number | scale factor |
Definition at line 58 of file QPVector.cpp.
Component-wise copy assignment.
| other | source vector |
Definition at line 200 of file QPVector.hpp.
In-place add.
fZ += other.fX); x and y are handled correctly. Only safe when both z components and other.fX are zero. | other | vector to add |
Definition at line 207 of file QPVector.hpp.
In-place subtract.
fZ -= other.fX). | other | vector to subtract |
Definition at line 214 of file QPVector.hpp.
|
inline |
Multiply all components in place.
| other | scale factor |
Definition at line 221 of file QPVector.hpp.
In-place cross product.
| other | second operand |
Definition at line 228 of file QPVector.hpp.
|
inline |
Reference to component i (0 = x, 1 = y, 2 = z).
| i | component index |
Definition at line 235 of file QPVector.hpp.
|
inline |
Reference to component i (0 = x, 1 = y, 2 = z); same behavior and warning as operator().
| i | component index |
Definition at line 241 of file QPVector.hpp.
| double QPVector::GetAngle | ( | QPVector | other | ) |
Angle between this vector and other, ![$ \arccos(\hat{a}\cdot\hat{b}) \in [0,\pi] $](form_88.png)
| other | second vector |
Definition at line 79 of file QPVector.cpp.
Referenced by GetAngleDegree().
| double QPVector::GetAngleDegree | ( | QPVector | other | ) |
GetAngle converted to degrees.
| other | second vector |
Definition at line 83 of file QPVector.cpp.
References GetAngle(), and QPMath::Pi.
| std::string QPVector::Print | ( | bool | quite = false | ) |
Formats the vector as "[x,y,z]".
| quite | when true, only returns the string; when false, also prints it to stdout |
Definition at line 87 of file QPVector.cpp.
Component-wise sum (lvalue overload).
| a | first operand |
| b | second operand |
Component-wise sum.
| a | first operand |
| b | second operand |
Definition at line 105 of file QPVector.cpp.
Component-wise difference.
| a | first operand |
| b | second operand |
Definition at line 113 of file QPVector.cpp.
Cross product 
| a | first operand |
| b | second operand |
Definition at line 124 of file QPVector.cpp.
Scaled copy.
| vec | vector operand |
| other | scale factor |
Definition at line 135 of file QPVector.cpp.
Scaled copy.
| other | scale factor |
| vec | vector operand |
Definition at line 147 of file QPVector.cpp.
Dot product.
| other | first operand |
| vec | second operand |
Definition at line 151 of file QPVector.cpp.