35#define INCLXX_IN_GEANT4_MODE 1
46#ifndef G4INCLThreeVector_hh
47#define G4INCLThreeVector_hh 1
58 :x(0.0), y(0.0), z(0.0)
74 inline G4double mag()
const {
return std::sqrt(x*x + y*y + z*z); }
85 return x == 0.0 && y == 0.0 && z == 0.0 ? 0.0 : std::atan2(
perp(),z);
92 return x == 0.0 && y == 0.0 ? 0.0 : std::atan2(y,x);
99 return (x*v.x + y*v.y + z*v.z);
179 const G4double cos = std::cos(angle);
180 const G4double sin = std::sin(angle);
181 (*this) = (*this) * cos + axis.
vector(*
this) * sin + axis * (axis.
dot(*
this)*(1.-cos));
185 std::stringstream ss;
186 ss <<
"(x = " << x <<
" y = " << y <<
" z = " << z <<
")";
191 std::stringstream ss;
192 ss <<
"(vector3 " << x <<
" " << y <<
" " << z <<
")";
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.
void operator*=(const T c)
std::string print() const
void rotate(const G4double angle, const ThreeVector &axis)
Rotate the vector by a given angle around a given axis.
void operator/=(const T c)
ThreeVector(G4double ax, G4double ay, G4double az)
ThreeVector operator+(const ThreeVector &v) const
G4double dot(const ThreeVector &v) const
void operator-=(const ThreeVector &v)
ThreeVector operator/(const G4double C) const
ThreeVector vector(const ThreeVector &v) const