Geant4-11
RotationInterfaces.icc
Go to the documentation of this file.
1// -*- C++ -*-
2// ---------------------------------------------------------------------------
3//
4// This file is a part of the CLHEP - a Class Library for High Energy Physics.
5//
6// This contains the definitions of the inline member functions of the
7// Hep4RotationInterface and Hep3RotationInterface classes, and of the
8// HepRep3x3 and HepRep4x4 structs.
9//
10
11namespace CLHEP {
12
13//-*********
14// HepRep3x3
15//-*********
16
17inline HepRep3x3::HepRep3x3() :
18 xx_(1.0), xy_(0.0), xz_(0.0)
19 , yx_(0.0), yy_(1.0), yz_(0.0)
20 , zx_(0.0), zy_(0.0), zz_(1.0)
21{}
22
23inline HepRep3x3::HepRep3x3( double xx, double xy, double xz
24 , double yx, double yy, double yz
25 , double zx, double zy, double zz
26 ) :
27 xx_(xx), xy_(xy), xz_(xz)
28 , yx_(yx), yy_(yy), yz_(yz)
29 , zx_(zx), zy_(zy), zz_(zz)
30{}
31
32inline HepRep3x3::HepRep3x3( const double * array ) {
33 const double * a = array;
34 double * r = &xx_;
35 for ( int i = 0; i < 9; i++ ) { *r++ = *a++; }
36}
37
38inline void HepRep3x3::setToIdentity() {
39 xx_ = 1.0; xy_ = 0.0; xz_ = 0.0;
40 yx_ = 0.0; yy_ = 1.0; yz_ = 0.0;
41 zx_ = 0.0; zy_ = 0.0; zz_ = 1.0;
42}
43
44inline void HepRep3x3::getArray( double * array ) const {
45 double * a = array;
46 const double * r = &xx_;
47 for ( int i = 0; i < 9; i++ ) { *a++ = *r++; }
48}
49
50
51//-*********
52// HepRep4x4
53//-*********
54
55inline HepRep4x4::HepRep4x4() :
56 xx_(1.0), xy_(0.0), xz_(0.0), xt_(0.0)
57 , yx_(0.0), yy_(1.0), yz_(0.0), yt_(0.0)
58 , zx_(0.0), zy_(0.0), zz_(1.0), zt_(0.0)
59 , tx_(0.0), ty_(0.0), tz_(0.0), tt_(1.0)
60{}
61
62inline HepRep4x4::HepRep4x4(
63 double xx, double xy, double xz, double xt
64 , double yx, double yy, double yz, double yt
65 , double zx, double zy, double zz, double zt
66 , double tx, double ty, double tz, double tt
67 ) :
68 xx_(xx), xy_(xy), xz_(xz), xt_(xt)
69 , yx_(yx), yy_(yy), yz_(yz), yt_(yt)
70 , zx_(zx), zy_(zy), zz_(zz), zt_(zt)
71 , tx_(tx), ty_(ty), tz_(tz), tt_(tt)
72{}
73
74inline HepRep4x4::HepRep4x4( const HepRep4x4Symmetric & rep ) :
75 xx_(rep.xx_), xy_(rep.xy_), xz_(rep.xz_), xt_(rep.xt_)
76 , yx_(rep.xy_), yy_(rep.yy_), yz_(rep.yz_), yt_(rep.yt_)
77 , zx_(rep.xz_), zy_(rep.yz_), zz_(rep.zz_), zt_(rep.zt_)
78 , tx_(rep.xt_), ty_(rep.yt_), tz_(rep.zt_), tt_(rep.tt_)
79{}
80
81inline HepRep4x4::HepRep4x4( const double * array ) {
82 const double * a = array;
83 double * r = &xx_;
84 for ( int i = 0; i < 16; i++ ) { *r++ = *a++; }
85}
86
87inline void HepRep4x4::setToIdentity() {
88 xx_ = 1.0; xy_ = 0.0; xz_ = 0.0; xt_ = 0.0;
89 yx_ = 0.0; yy_ = 1.0; yz_ = 0.0; yt_ = 0.0;
90 zx_ = 0.0; zy_ = 0.0; zz_ = 1.0; zt_ = 0.0;
91 tx_ = 0.0; ty_ = 0.0; tz_ = 0.0; tt_ = 1.0;
92}
93
94inline void HepRep4x4::getArray( double * array ) const {
95 double * a = array;
96 const double * r = &xx_;
97 for ( int i = 0; i < 16; i++ ) { *a++ = *r++; }
98}
99
100inline bool HepRep4x4::operator == (const HepRep4x4 & r) const {
101 return( xx_ == r.xx_ && xy_ == r.xy_ && xz_ == r.xz_ && xt_ == r.xt_ &&
102 yx_ == r.yx_ && yy_ == r.yy_ && yz_ == r.yz_ && yt_ == r.yt_ &&
103 zx_ == r.zx_ && zy_ == r.zy_ && zz_ == r.zz_ && zt_ == r.zt_ &&
104 tx_ == r.tx_ && ty_ == r.ty_ && tz_ == r.tz_ && tt_ == r.tt_ );
105}
106
107inline bool HepRep4x4::operator != (const HepRep4x4 & r) const {
108 return !(operator== (r));
109}
110
111//-******************
112// HepRep4x4Symmetric
113//-******************
114
115inline HepRep4x4Symmetric::HepRep4x4Symmetric() :
116 xx_(1.0), xy_(0.0), xz_(0.0), xt_(0.0)
117 , yy_(1.0), yz_(0.0), yt_(0.0)
118 , zz_(1.0), zt_(0.0)
119 , tt_(1.0)
120{}
121
122inline HepRep4x4Symmetric::HepRep4x4Symmetric
123 ( double xx, double xy, double xz, double xt
124 , double yy, double yz, double yt
125 , double zz, double zt
126 , double tt ) :
127 xx_(xx), xy_(xy), xz_(xz), xt_(xt)
128 , yy_(yy), yz_(yz), yt_(yt)
129 , zz_(zz), zt_(zt)
130 , tt_(tt)
131{}
132
133inline HepRep4x4Symmetric::HepRep4x4Symmetric( const double * array ) {
134 const double * a = array;
135 double * r = &xx_;
136 for ( int i = 0; i < 10; i++ ) { *r++ = *a++; }
137}
138
139inline void HepRep4x4Symmetric::setToIdentity() {
140 xx_ = 1.0; xy_ = 0.0; xz_ = 0.0; xt_ = 0.0;
141 yy_ = 1.0; yz_ = 0.0; yt_ = 0.0;
142 zz_ = 1.0; zt_ = 0.0;
143 tt_ = 1.0;
144}
145
146inline void HepRep4x4Symmetric::getArray( double * array ) const {
147 double * a = array;
148 const double * r = &xx_;
149 for ( int i = 0; i < 10; i++ ) { *a++ = *r++; }
150}
151
152} // namespace CLHEP