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