File indexing completed on 2025-01-18 09:54:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <cmath>
0011 #include "CLHEP/Units/PhysicalConstants.h"
0012
0013 namespace CLHEP {
0014
0015 inline double HepRotationX::yy() const { return its_c; }
0016 inline double HepRotationX::yz() const { return -its_s; }
0017 inline double HepRotationX::zy() const { return its_s; }
0018 inline double HepRotationX::zz() const { return its_c; }
0019
0020 inline double HepRotationX::xx() const { return 1.0; }
0021 inline double HepRotationX::xy() const { return 0.0; }
0022 inline double HepRotationX::xz() const { return 0.0; }
0023 inline double HepRotationX::yx() const { return 0.0; }
0024 inline double HepRotationX::zx() const { return 0.0; }
0025
0026 inline HepRep3x3 HepRotationX::rep3x3() const {
0027 return HepRep3x3 ( 1.0, 0.0, 0.0,
0028 0.0, its_c, -its_s,
0029 0.0, its_s, its_c );
0030 }
0031
0032 inline HepRotationX::HepRotationX() : its_d(0.0), its_s(0.0), its_c(1.0) {}
0033
0034 inline HepRotationX::HepRotationX(const HepRotationX & orig) :
0035 its_d(orig.its_d), its_s(orig.its_s), its_c(orig.its_c)
0036 {}
0037
0038 inline HepRotationX::HepRotationX(double dd, double ss, double cc) :
0039 its_d(dd), its_s(ss), its_c(cc)
0040 {}
0041
0042 inline HepRotationX & HepRotationX::operator= (const HepRotationX & orig) {
0043 its_d = orig.its_d;
0044 its_s = orig.its_s;
0045 its_c = orig.its_c;
0046 return *this;
0047 }
0048
0049 inline HepRotationX::~HepRotationX() {}
0050
0051 inline Hep3Vector HepRotationX::colX() const
0052 { return Hep3Vector ( 1.0, 0.0, 0.0 ); }
0053 inline Hep3Vector HepRotationX::colY() const
0054 { return Hep3Vector ( 0.0, its_c, its_s ); }
0055 inline Hep3Vector HepRotationX::colZ() const
0056 { return Hep3Vector ( 0.0, -its_s, its_c ); }
0057
0058 inline Hep3Vector HepRotationX::rowX() const
0059 { return Hep3Vector ( 1.0, 0.0, 0.0 ); }
0060 inline Hep3Vector HepRotationX::rowY() const
0061 { return Hep3Vector ( 0.0, its_c, -its_s ); }
0062 inline Hep3Vector HepRotationX::rowZ() const
0063 { return Hep3Vector ( 0.0, its_s, its_c ); }
0064
0065 inline double HepRotationX::getPhi () const { return phi(); }
0066 inline double HepRotationX::getTheta() const { return theta(); }
0067 inline double HepRotationX::getPsi () const { return psi(); }
0068 inline double HepRotationX::getDelta() const { return its_d; }
0069 inline Hep3Vector HepRotationX::getAxis () const { return axis(); }
0070
0071 inline double HepRotationX::delta() const { return its_d; }
0072 inline Hep3Vector HepRotationX::axis() const { return Hep3Vector(1,0,0); }
0073
0074 inline HepAxisAngle HepRotationX::axisAngle() const {
0075 return HepAxisAngle ( axis(), delta() );
0076 }
0077
0078 inline void HepRotationX::getAngleAxis
0079 (double & ddelta, Hep3Vector & aaxis) const {
0080 ddelta = its_d;
0081 aaxis = getAxis();
0082 }
0083
0084 inline HepLorentzVector HepRotationX::col1() const
0085 { return HepLorentzVector (colX(), 0); }
0086 inline HepLorentzVector HepRotationX::col2() const
0087 { return HepLorentzVector (colY(), 0); }
0088 inline HepLorentzVector HepRotationX::col3() const
0089 { return HepLorentzVector (colZ(), 0); }
0090 inline HepLorentzVector HepRotationX::col4() const
0091 { return HepLorentzVector (0,0,0,1); }
0092 inline HepLorentzVector HepRotationX::row1() const
0093 { return HepLorentzVector (rowX(), 0); }
0094 inline HepLorentzVector HepRotationX::row2() const
0095 { return HepLorentzVector (rowY(), 0); }
0096 inline HepLorentzVector HepRotationX::row3() const
0097 { return HepLorentzVector (rowZ(), 0); }
0098 inline HepLorentzVector HepRotationX::row4() const
0099 { return HepLorentzVector (0,0,0,1); }
0100 inline double HepRotationX::xt() const { return 0.0; }
0101 inline double HepRotationX::yt() const { return 0.0; }
0102 inline double HepRotationX::zt() const { return 0.0; }
0103 inline double HepRotationX::tx() const { return 0.0; }
0104 inline double HepRotationX::ty() const { return 0.0; }
0105 inline double HepRotationX::tz() const { return 0.0; }
0106 inline double HepRotationX::tt() const { return 1.0; }
0107
0108 inline HepRep4x4 HepRotationX::rep4x4() const {
0109 return HepRep4x4 ( 1.0, 0.0, 0.0, 0.0,
0110 0.0, its_c, -its_s, 0.0,
0111 0.0, its_s, its_c, 0.0,
0112 0.0, 0.0, 0.0, 1.0 );
0113 }
0114
0115 inline bool HepRotationX::isIdentity() const {
0116 return ( its_d==0 );
0117 }
0118
0119 inline int HepRotationX::compare ( const HepRotationX & r ) const {
0120 if (its_d > r.its_d) return 1; else if (its_d < r.its_d) return -1; else return 0;
0121 }
0122
0123 inline bool HepRotationX::operator==(const HepRotationX & r) const
0124 { return (its_d==r.its_d); }
0125 inline bool HepRotationX::operator!=(const HepRotationX & r) const
0126 { return (its_d!=r.its_d); }
0127 inline bool HepRotationX::operator>=(const HepRotationX & r) const
0128 { return (its_d>=r.its_d); }
0129 inline bool HepRotationX::operator<=(const HepRotationX & r) const
0130 { return (its_d<=r.its_d); }
0131 inline bool HepRotationX::operator> (const HepRotationX & r) const
0132 { return (its_d> r.its_d); }
0133 inline bool HepRotationX::operator< (const HepRotationX & r) const
0134 { return (its_d< r.its_d); }
0135
0136 inline void HepRotationX::rectify() {
0137 its_d = proper(its_d);
0138 its_s = std::sin(its_d);
0139 its_c = std::cos(its_d);
0140 }
0141
0142 inline Hep3Vector HepRotationX::operator() (const Hep3Vector & p) const {
0143 double x = p.x();
0144 double y = p.y();
0145 double z = p.z();
0146 return Hep3Vector( x,
0147 y * its_c - z * its_s,
0148 z * its_c + y * its_s );
0149 }
0150
0151 inline Hep3Vector HepRotationX::operator * (const Hep3Vector & p) const {
0152 return operator()(p);
0153 }
0154
0155 inline HepLorentzVector HepRotationX::operator()
0156 ( const HepLorentzVector & w ) const {
0157 return HepLorentzVector( operator() (w.vect()) , w.t() );
0158 }
0159
0160 inline HepLorentzVector HepRotationX::operator *
0161 (const HepLorentzVector & p) const {
0162 return operator()(p);
0163 }
0164
0165 inline HepRotationX & HepRotationX::operator *= (const HepRotationX & m1) {
0166 return *this = (*this) * (m1);
0167 }
0168
0169 inline HepRotationX & HepRotationX::transform(const HepRotationX & m1) {
0170 return *this = m1 * (*this);
0171 }
0172
0173 inline double HepRotationX::proper( double ddelta ) {
0174
0175 if ( std::fabs(ddelta) < CLHEP::pi ) {
0176 return ddelta;
0177 } else {
0178 double x = ddelta / (CLHEP::twopi);
0179 return (CLHEP::twopi) * ( x + std::floor(.5-x) );
0180 }
0181 }
0182
0183 inline HepRotationX HepRotationX::operator * ( const HepRotationX & rx ) const {
0184 return HepRotationX ( HepRotationX::proper(its_d+rx.its_d),
0185 its_s*rx.its_c + its_c*rx.its_s,
0186 its_c*rx.its_c - its_s*rx.its_s );
0187 }
0188
0189 inline HepRotationX HepRotationX::inverse() const {
0190 return HepRotationX( proper(-its_d), -its_s, its_c );
0191 }
0192
0193 inline HepRotationX inverseOf(const HepRotationX & r) {
0194 return r.inverse();
0195 }
0196
0197 inline HepRotationX & HepRotationX::invert() {
0198 return *this=inverse();
0199 }
0200
0201 inline double HepRotationX::getTolerance() {
0202 return Hep4RotationInterface::tolerance;
0203 }
0204 inline double HepRotationX::setTolerance(double tol) {
0205 return Hep4RotationInterface::setTolerance(tol);
0206 }
0207
0208 }