34#define INCLXX_IN_GEANT4_MODE 1
45#ifndef G4INCLThreeVector_hh
46#define G4INCLThreeVector_hh 1
57 :x(0.0), y(0.0), z(0.0)
73 inline G4double mag()
const {
return std::sqrt(x*x + y*y + z*z); }
84 return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : std::atan2(
perp(),z);
91 return x == 0.0 && y == 0.0 ? 0.0 : std::atan2(y,x);
98 return (x*v.x + y*v.y + z*v.z);
167 return ThreeVector(x*oneOverC, y*oneOverC, z*oneOverC);
181 const G4double cos = std::cos(angle);
182 const G4double sin = std::sin(angle);
183 (*this) = (*this) * cos + axis.
vector(*
this) * sin + axis * (axis.
dot(*
this)*(1.-cos));
194 else if(y<=x && y<=z)
201 std::stringstream ss;
202 ss <<
"(x = " << x <<
" y = " << y <<
" z = " << z <<
")";
207 std::stringstream ss;
208 ss <<
"(vector3 " << x <<
" " << y <<
" " << z <<
")";
G4double C(G4double temp)
void setY(G4double ay)
Set the y coordinate.
ThreeVector operator*(const G4double C) const
void operator+=(const ThreeVector &v)
void setZ(G4double az)
Set the z coordinate.
ThreeVector operator-() const
Unary minus operator.
void setX(G4double ax)
Set the x coordinate.
std::string print() const
void operator*=(const T &c)
void rotate(const G4double angle, const ThreeVector &axis)
Rotate the vector by a given angle around a given axis.
ThreeVector(G4double ax, G4double ay, G4double az)
ThreeVector operator+(const ThreeVector &v) const
G4double dot(const ThreeVector &v) const
void operator/=(const T &c)
void operator-=(const ThreeVector &v)
ThreeVector anyOrthogonal() const
Return a vector orthogonal to this.
ThreeVector operator/(const G4double C) const
void set(const G4double ax, const G4double ay, const G4double az)
Set all the coordinates.
ThreeVector vector(const ThreeVector &v) const