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)
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);
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 <<
")";
void setZ(G4double az)
Set the z coordinate.
ThreeVector operator/(const G4double C) const
ThreeVector vector(const ThreeVector &v) const
G4double dot(const ThreeVector &v) const
void operator*=(const T &c)
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.
ThreeVector anyOrthogonal() const
Return a vector orthogonal to this.
ThreeVector operator+(const ThreeVector &v) const
ThreeVector(G4double ax, G4double ay, G4double az)
ThreeVector operator-() const
Unary minus operator.
void operator-=(const ThreeVector &v)
ThreeVector operator*(const G4double C) const
void set(const G4double ax, const G4double ay, const G4double az)
Set all the coordinates.
void operator+=(const ThreeVector &v)
void setY(G4double ay)
Set the y coordinate.