]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/CLHEP/Vector/Rotation.icc
This commit was generated by cvs2svn to compensate for changes in r2,
[u/mrichter/AliRoot.git] / PHOS / CLHEP / Vector / Rotation.icc
1 // -*- C++ -*-
2 // $Id$
3 // ---------------------------------------------------------------------------
4 //
5 // This file is a part of the CLHEP - a Class Library for High Energy Physics.
6 // 
7 // This is the definitions of the inline member functions of the
8 // HepRotation class
9 //
10
11 #ifdef HEP_DEBUG_INLINE
12 #define inline
13 #endif
14
15 inline HepRotation::HepRotation()
16 : rxx(1.0), rxy(0.0), rxz(0.0), ryx(0.0), ryy(1.0), ryz(0.0),
17   rzx(0.0), rzy(0.0), rzz(1.0) {}
18
19 inline HepRotation::HepRotation(const HepRotation & m)
20 : rxx(m.rxx), rxy(m.rxy), rxz(m.rxz), ryx(m.ryx), ryy(m.ryy), ryz(m.ryz),
21   rzx(m.rzx), rzy(m.rzy), rzz(m.rzz) {}
22
23 inline HepRotation::HepRotation(HepDouble mxx, HepDouble mxy, HepDouble mxz,
24                          HepDouble myx, HepDouble myy, HepDouble myz,
25                          HepDouble mzx, HepDouble mzy, HepDouble mzz)
26 : rxx(mxx), rxy(mxy), rxz(mxz), ryx(myx), ryy(myy), ryz(myz),
27   rzx(mzx), rzy(mzy), rzz(mzz) {}
28
29 inline HepDouble HepRotation::xx() const { return rxx; }
30 inline HepDouble HepRotation::xy() const { return rxy; }
31 inline HepDouble HepRotation::xz() const { return rxz; }
32 inline HepDouble HepRotation::yx() const { return ryx; }
33 inline HepDouble HepRotation::yy() const { return ryy; }
34 inline HepDouble HepRotation::yz() const { return ryz; }
35 inline HepDouble HepRotation::zx() const { return rzx; }
36 inline HepDouble HepRotation::zy() const { return rzy; }
37 inline HepDouble HepRotation::zz() const { return rzz; }
38
39 inline HepRotation & HepRotation::operator = (const HepRotation & m) {
40   rxx = m.rxx;
41   rxy = m.rxy;
42   rxz = m.rxz;
43   ryx = m.ryx;
44   ryy = m.ryy;
45   ryz = m.ryz;
46   rzx = m.rzx;
47   rzy = m.rzy;
48   rzz = m.rzz;
49   return *this;
50 }
51
52 inline HepBoolean HepRotation::operator == (const HepRotation& m) const {
53   return (rxx == m.rxx && rxy == m.rxy && rxz == m.rxz &&
54           ryx == m.ryx && ryy == m.ryy && ryz == m.ryz &&
55           rzx == m.rzx && rzy == m.rzy && rzz == m.rzz) ? true : false;
56
57
58 inline HepBoolean HepRotation::operator != (const HepRotation &m) const {
59   return (rxx != m.rxx || rxy != m.rxy || rxz != m.rxz ||
60           ryx != m.ryx || ryy != m.ryy || ryz != m.ryz ||
61           rzx != m.rzx || rzy != m.rzy || rzz != m.rzz) ? true : false;
62 }
63
64 inline HepBoolean HepRotation::isIdentity() const {
65   return  (rxx == 1.0 && rxy == 0.0 && rxz == 0.0 &&
66            ryx == 0.0 && ryy == 1.0 && ryz == 0.0 &&
67            rzx == 0.0 && rzy == 0.0 && rzz == 1.0) ? true : false;
68 }
69
70 inline Hep3Vector HepRotation::operator * (const Hep3Vector & p) const {
71   return Hep3Vector(rxx*p.x() + rxy*p.y() + rxz*p.z(),
72                     ryx*p.x() + ryy*p.y() + ryz*p.z(),
73                     rzx*p.x() + rzy*p.y() + rzz*p.z());
74 }
75
76 inline HepRotation & HepRotation::operator *= (const HepRotation & m) {
77   return *this = operator * (m);
78 }
79
80 inline HepRotation & HepRotation::transform(const HepRotation & m) {
81   return *this = m.operator * (*this);
82 }
83
84 inline HepRotation HepRotation::inverse() const {
85   return HepRotation(rxx, ryx, rzx, rxy, ryy, rzy, rxz, ryz, rzz);
86 }
87
88 inline HepRotation & HepRotation::invert() {
89   return *this=inverse();
90 }
91
92 inline HepRotation & HepRotation::rotate(HepDouble psi, const Hep3Vector * p) {
93   return rotate(psi, *p);
94 }
95
96 #ifdef HEP_DEBUG_INLINE
97 #undef inline
98 #endif