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