source: trunk/CLHEP/Vector/RotationInterfaces.icc@ 13

Last change on this file since 13 was 4, checked in by Pavel Demin, 17 years ago

first commit

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