RotationX.icc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 // ---------------------------------------------------------------------------
00003 //
00004 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
00005 // 
00006 // This is the definitions of the inline member functions of the
00007 // HepRotationX class
00008 //
00009 
00010 #include <cmath>
00011 #include "CLHEP/Units/PhysicalConstants.h"
00012 
00013 namespace CLHEP {
00014 
00015 inline double HepRotationX::yy() const { return its_c; }
00016 inline double HepRotationX::yz() const { return -its_s; }
00017 inline double HepRotationX::zy() const { return its_s; }
00018 inline double HepRotationX::zz() const { return its_c; }
00019 
00020 inline double HepRotationX::xx() const { return 1.0; }
00021 inline double HepRotationX::xy() const { return 0.0; }
00022 inline double HepRotationX::xz() const { return 0.0; }
00023 inline double HepRotationX::yx() const { return 0.0; }
00024 inline double HepRotationX::zx() const { return 0.0; }
00025 
00026 inline HepRep3x3 HepRotationX::rep3x3() const {
00027   return HepRep3x3 ( 1.0,    0.0,      0.0,
00028                      0.0,  its_c,   -its_s,
00029                      0.0,  its_s,    its_c  );
00030 }
00031 
00032 inline HepRotationX::HepRotationX() : its_d(0.0), its_s(0.0), its_c(1.0) {}
00033 
00034 inline HepRotationX::HepRotationX(const HepRotationX & orig) : 
00035         its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c)
00036 {}
00037 
00038 inline HepRotationX::HepRotationX(double dd, double ss, double cc) :
00039         its_d(dd), its_s(ss), its_c(cc)
00040 {}
00041 
00042 inline HepRotationX & HepRotationX::operator= (const HepRotationX & orig) {
00043   its_d = orig.its_d;
00044   its_s = orig.its_s; 
00045   its_c = orig.its_c;
00046   return *this;
00047 }
00048 
00049 inline HepRotationX::~HepRotationX() {}
00050 
00051 inline Hep3Vector HepRotationX::colX() const 
00052                                 { return Hep3Vector ( 1.0, 0.0, 0.0 ); }
00053 inline Hep3Vector HepRotationX::colY() const 
00054                                 { return Hep3Vector ( 0.0,  its_c,  its_s ); }
00055 inline Hep3Vector HepRotationX::colZ() const 
00056                                 { return Hep3Vector ( 0.0, -its_s,  its_c ); }
00057  
00058 inline Hep3Vector HepRotationX::rowX() const 
00059                                 { return Hep3Vector ( 1.0, 0.0, 0.0 ); }
00060 inline Hep3Vector HepRotationX::rowY() const 
00061                                 { return Hep3Vector ( 0.0,  its_c, -its_s ); }
00062 inline Hep3Vector HepRotationX::rowZ() const 
00063                                 { return Hep3Vector ( 0.0,  its_s,  its_c ); }
00064 
00065 inline double  HepRotationX::getPhi  () const { return phi();   }
00066 inline double  HepRotationX::getTheta() const { return theta(); }
00067 inline double  HepRotationX::getPsi  () const { return psi();   }
00068 inline double  HepRotationX::getDelta() const { return its_d; }
00069 inline Hep3Vector HepRotationX::getAxis () const { return axis();  }
00070 
00071 inline double  HepRotationX::delta() const { return its_d; }
00072 inline Hep3Vector HepRotationX::axis() const { return Hep3Vector(1,0,0); }
00073 
00074 inline HepAxisAngle HepRotationX::axisAngle() const {
00075   return HepAxisAngle ( axis(), delta() );
00076 }
00077 
00078 inline void HepRotationX::getAngleAxis
00079                         (double & ddelta, Hep3Vector & aaxis) const {
00080   ddelta = its_d;
00081   aaxis  = getAxis();
00082 }
00083 
00084 inline HepLorentzVector HepRotationX::col1() const 
00085                                 { return HepLorentzVector (colX(), 0); }
00086 inline HepLorentzVector HepRotationX::col2() const
00087                                 { return HepLorentzVector (colY(), 0); }
00088 inline HepLorentzVector HepRotationX::col3() const
00089                                 { return HepLorentzVector (colZ(), 0); }
00090 inline HepLorentzVector HepRotationX::col4() const
00091                                 { return HepLorentzVector (0,0,0,1); }
00092 inline HepLorentzVector HepRotationX::row1() const
00093                                 { return HepLorentzVector (rowX(), 0); }
00094 inline HepLorentzVector HepRotationX::row2() const
00095                                 { return HepLorentzVector (rowY(), 0); }
00096 inline HepLorentzVector HepRotationX::row3() const
00097                                 { return HepLorentzVector (rowZ(), 0); }
00098 inline HepLorentzVector HepRotationX::row4() const
00099                                 { return HepLorentzVector (0,0,0,1); }
00100 inline double HepRotationX::xt() const { return 0.0; }
00101 inline double HepRotationX::yt() const { return 0.0; }
00102 inline double HepRotationX::zt() const { return 0.0; }
00103 inline double HepRotationX::tx() const { return 0.0; }
00104 inline double HepRotationX::ty() const { return 0.0; }
00105 inline double HepRotationX::tz() const { return 0.0; }
00106 inline double HepRotationX::tt() const { return 1.0; }
00107 
00108 inline HepRep4x4 HepRotationX::rep4x4() const {
00109   return HepRep4x4 ( 1.0,   0.0,    0.0, 0.0,
00110                      0.0, its_c, -its_s, 0.0,
00111                      0.0, its_s,  its_c, 0.0,
00112                      0.0,   0.0,    0.0, 1.0 );
00113 }
00114 
00115 inline bool HepRotationX::isIdentity() const {
00116   return ( its_d==0 );
00117 }
00118 
00119 inline int HepRotationX::compare ( const HepRotationX & r  ) const {
00120   if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0;
00121 }
00122 
00123 inline bool HepRotationX::operator==(const HepRotationX & r)  const
00124   { return (its_d==r.its_d); }
00125 inline bool HepRotationX::operator!=(const HepRotationX & r)  const
00126   { return (its_d!=r.its_d); }
00127 inline bool HepRotationX::operator>=(const HepRotationX & r)  const
00128   { return (its_d>=r.its_d); }
00129 inline bool HepRotationX::operator<=(const HepRotationX & r)  const
00130   { return (its_d<=r.its_d); }
00131 inline bool HepRotationX::operator> (const HepRotationX & r)  const
00132   { return (its_d> r.its_d); }
00133 inline bool HepRotationX::operator< (const HepRotationX & r)  const
00134   { return (its_d< r.its_d); }
00135 
00136 inline void HepRotationX::rectify() { 
00137   its_d = proper(its_d);  // Just in case!
00138   its_s = std::sin(its_d);
00139   its_c = std::cos(its_d);
00140 } 
00141 
00142 inline Hep3Vector HepRotationX::operator() (const Hep3Vector & p) const {
00143   double x = p.x();
00144   double y = p.y();
00145   double z = p.z();
00146   return  Hep3Vector(  x,
00147                        y * its_c - z * its_s,
00148                        z * its_c + y * its_s  );
00149 }
00150 
00151 inline Hep3Vector HepRotationX::operator * (const Hep3Vector & p) const {
00152   return operator()(p);
00153 }
00154 
00155 inline HepLorentzVector HepRotationX::operator()
00156                         ( const HepLorentzVector & w ) const {
00157   return  HepLorentzVector( operator() (w.vect()) , w.t() );
00158 }
00159 
00160 inline HepLorentzVector HepRotationX::operator * 
00161                                         (const HepLorentzVector & p) const {
00162   return operator()(p);
00163 }
00164 
00165 inline HepRotationX & HepRotationX::operator *= (const HepRotationX & m1) {
00166   return *this = (*this) * (m1);
00167 }
00168 
00169 inline HepRotationX & HepRotationX::transform(const HepRotationX & m1) {
00170   return *this = m1 * (*this);
00171 }
00172 
00173 inline double HepRotationX::proper( double ddelta ) {
00174   // -PI < d <= PI
00175   if ( std::fabs(ddelta) < CLHEP::pi ) {
00176     return  ddelta;
00177   } else {
00178     register double x = ddelta / (CLHEP::twopi);
00179     return  (CLHEP::twopi) * ( x + std::floor(.5-x) );
00180   }
00181 }  // proper()
00182 
00183 inline HepRotationX HepRotationX::operator * ( const HepRotationX & rx ) const {
00184   return HepRotationX ( HepRotationX::proper(its_d+rx.its_d),
00185                         its_s*rx.its_c + its_c*rx.its_s,
00186                         its_c*rx.its_c - its_s*rx.its_s );
00187 }
00188 
00189 inline HepRotationX HepRotationX::inverse() const {
00190   return HepRotationX( proper(-its_d), -its_s, its_c ); 
00191 }
00192 
00193 inline HepRotationX inverseOf(const HepRotationX & r) {
00194   return r.inverse();
00195 }
00196 
00197 inline HepRotationX & HepRotationX::invert() {
00198   return *this=inverse();
00199 }
00200 
00201 inline double HepRotationX::getTolerance() {
00202   return Hep4RotationInterface::tolerance;
00203 }       
00204 inline double HepRotationX::setTolerance(double tol) {
00205   return Hep4RotationInterface::setTolerance(tol);
00206 }
00207 
00208 }  // namespace CLHEP

Generated on Mon May 27 17:50:34 2013 for Geant4 by  doxygen 1.4.7