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