Files
geant4/source/externals/clhep/include/CLHEP/Vector/RotationY.icc
T
2016-06-09 16:46:55 +02:00

210 lines
6.8 KiB
C++

// -*- C++ -*-
// ---------------------------------------------------------------------------
//
// This file is a part of the CLHEP - a Class Library for High Energy Physics.
//
// This is the definitions of the inline member functions of the
// HepRotationY class
//
#include <cmath>
#include "CLHEP/Units/PhysicalConstants.h"
namespace CLHEP {
inline double HepRotationY::xx() const { return c; }
inline double HepRotationY::xz() const { return s; }
inline double HepRotationY::zx() const { return -s; }
inline double HepRotationY::zz() const { return c; }
inline double HepRotationY::yy() const { return 1.0; }
inline double HepRotationY::yx() const { return 0.0; }
inline double HepRotationY::yz() const { return 0.0; }
inline double HepRotationY::xy() const { return 0.0; }
inline double HepRotationY::zy() const { return 0.0; }
inline HepRep3x3 HepRotationY::rep3x3() const {
return HepRep3x3 ( c , 0.0, s,
0.0, 1.0, 0.0,
-s , 0.0, c );
}
inline HepRotationY::HepRotationY() : d(0.0), s(0.0), c(1.0) {}
inline HepRotationY::HepRotationY(const HepRotationY & orig) :
d(orig.d), s(orig.s), c(orig.c)
{}
inline HepRotationY::HepRotationY(double dd, double ss, double cc) :
d(dd), s(ss), c(cc)
{}
inline HepRotationY & HepRotationY::operator= (const HepRotationY & orig) {
d = orig.d;
s = orig.s;
c = orig.c;
return *this;
}
inline HepRotationY::~HepRotationY() {}
inline Hep3Vector HepRotationY::colX() const
{ return Hep3Vector ( c, 0.0, -s ); }
inline Hep3Vector HepRotationY::colY() const
{ return Hep3Vector ( 0.0, 1.0, 0.0 ); }
inline Hep3Vector HepRotationY::colZ() const
{ return Hep3Vector ( s, 0.0, c ); }
inline Hep3Vector HepRotationY::rowX() const
{ return Hep3Vector ( c, 0.0, s ); }
inline Hep3Vector HepRotationY::rowY() const
{ return Hep3Vector ( 0.0, 1.0, 0.0 ); }
inline Hep3Vector HepRotationY::rowZ() const
{ return Hep3Vector ( -s, 0.0, c ); }
inline double HepRotationY::getPhi () const { return phi(); }
inline double HepRotationY::getTheta() const { return theta(); }
inline double HepRotationY::getPsi () const { return psi(); }
inline double HepRotationY::getDelta() const { return d; }
inline Hep3Vector HepRotationY::getAxis () const { return axis(); }
inline double HepRotationY::delta() const { return d; }
inline Hep3Vector HepRotationY::axis() const { return Hep3Vector(0,1,0); }
inline HepAxisAngle HepRotationY::axisAngle() const {
return HepAxisAngle ( axis(), delta() );
}
inline void HepRotationY::getAngleAxis
(double & delta, Hep3Vector & axis) const {
delta = d;
axis = getAxis();
}
inline bool HepRotationY::isIdentity() const {
return ( d==0 );
}
inline int HepRotationY::compare ( const HepRotationY & r ) const {
if (d > r.d) return 1; else if (d < r.d) return -1; else return 0;
}
inline bool HepRotationY::operator==(const HepRotationY & r) const
{ return (d==r.d); }
inline bool HepRotationY::operator!=(const HepRotationY & r) const
{ return (d!=r.d); }
inline bool HepRotationY::operator>=(const HepRotationY & r) const
{ return (d>=r.d); }
inline bool HepRotationY::operator<=(const HepRotationY & r) const
{ return (d<=r.d); }
inline bool HepRotationY::operator> (const HepRotationY & r) const
{ return (d> r.d); }
inline bool HepRotationY::operator< (const HepRotationY & r) const
{ return (d< r.d); }
inline void HepRotationY::rectify() {
d = proper(d); // Just in case!
s = std::sin(d);
c = std::cos(d);
}
inline Hep3Vector HepRotationY::operator() (const Hep3Vector & p) const {
double x = p.x();
double y = p.y();
double z = p.z();
return Hep3Vector( x * c + z * s,
y,
z * c - x * s );
}
inline Hep3Vector HepRotationY::operator * (const Hep3Vector & p) const {
return operator()(p);
}
inline HepLorentzVector HepRotationY::operator()
( const HepLorentzVector & w ) const {
return HepLorentzVector( operator() (w.vect()) , w.t() );
}
inline HepLorentzVector HepRotationY::operator *
(const HepLorentzVector & p) const {
return operator()(p);
}
inline HepRotationY & HepRotationY::operator *= (const HepRotationY & m) {
return *this = (*this) * (m);
}
inline HepRotationY & HepRotationY::transform(const HepRotationY & m) {
return *this = m * (*this);
}
inline double HepRotationY::proper( double delta ) {
// -PI < d <= PI
if ( std::fabs(delta) < CLHEP::pi ) {
return delta;
} else {
register double x = delta / (CLHEP::twopi);
return (CLHEP::twopi) * ( x + std::floor(.5-x) );
}
} // proper()
inline HepRotationY HepRotationY::operator * ( const HepRotationY & ry ) const {
return HepRotationY ( HepRotationY::proper(d+ry.d),
s*ry.c + c*ry.s,
c*ry.c - s*ry.s );
}
inline HepRotationY HepRotationY::inverse() const {
return HepRotationY( proper(-d), -s, c );
}
inline HepRotationY inverseOf(const HepRotationY & r) {
return r.inverse();
}
inline HepRotationY & HepRotationY::invert() {
return *this=inverse();
}
inline HepLorentzVector HepRotationY::col1() const
{ return HepLorentzVector (colX(), 0); }
inline HepLorentzVector HepRotationY::col2() const
{ return HepLorentzVector (colY(), 0); }
inline HepLorentzVector HepRotationY::col3() const
{ return HepLorentzVector (colZ(), 0); }
inline HepLorentzVector HepRotationY::col4() const
{ return HepLorentzVector (0,0,0,1); }
inline HepLorentzVector HepRotationY::row1() const
{ return HepLorentzVector (rowX(), 0); }
inline HepLorentzVector HepRotationY::row2() const
{ return HepLorentzVector (rowY(), 0); }
inline HepLorentzVector HepRotationY::row3() const
{ return HepLorentzVector (rowZ(), 0); }
inline HepLorentzVector HepRotationY::row4() const
{ return HepLorentzVector (0,0,0,1); }
inline double HepRotationY::xt() const { return 0.0; }
inline double HepRotationY::yt() const { return 0.0; }
inline double HepRotationY::zt() const { return 0.0; }
inline double HepRotationY::tx() const { return 0.0; }
inline double HepRotationY::ty() const { return 0.0; }
inline double HepRotationY::tz() const { return 0.0; }
inline double HepRotationY::tt() const { return 1.0; }
inline HepRep4x4 HepRotationY::rep4x4() const {
return HepRep4x4 ( c , 0.0, s, 0.0,
0.0, 1.0, 0.0, 0.0,
-s , 0.0, c, 0.0,
0.0, 0.0, 0.0, 1.0 );
}
inline double HepRotationY::getTolerance() {
return Hep4RotationInterface::tolerance;
}
inline double HepRotationY::setTolerance(double tol) {
return Hep4RotationInterface::setTolerance(tol);
}
} // namespace CLHEP