9#include "CLHEP/Units/GlobalSystemOfUnits.h"
10#include "CLHEP/Units/GlobalPhysicalConstants.h"
11#include "CLHEP/Vector/Rotation.h"
12#include "CLHEP/Vector/ThreeVector.h"
27 double angA=CLHEP::pi/3, angB=CLHEP::pi/4, angC=CLHEP::pi/6;
28 double cosA =std::cos(angA), sinA =std::sin(angA);
29 double cosB =std::cos(angB), sinB =std::sin(angB);
30 double cosC =std::cos(angC), sinC =std::sin(angC);
33 assert ( R.
xx() == 1 );
34 assert ( R.
xy() == 0 );
35 assert ( R.
xz() == 0 );
36 assert ( R.
yx() == 0 );
37 assert ( R.
yy() == 1 );
38 assert ( R.
yz() == 0 );
39 assert ( R.
zx() == 0 );
40 assert ( R.
zy() == 0 );
41 assert ( R.
zz() == 1 );
43 assert( R.isIdentity() );
47 assert ( R.
xx() == 1 );
48 assert ( R.
xy() == 0 );
49 assert ( R.
xz() == 0 );
50 assert ( R.
yx() == 0 );
51 assert ( R.
yy() == cosA );
52 assert ( R.
yz() ==-sinA );
53 assert ( R.
zx() == 0 );
54 assert ( R.
zy() == sinA );
55 assert ( R.
zz() == cosA );
59 assert ( R.
xx() == cosB );
60 assert ( R.
xy() == 0 );
61 assert ( R.
xz() == sinB );
62 assert ( R.
yx() == 0 );
63 assert ( R.
yy() == 1 );
64 assert ( R.
yz() == 0 );
65 assert ( R.
zx() ==-sinB );
66 assert ( R.
zy() == 0 );
67 assert ( R.
zz() == cosB );
71 assert ( R.
xx() == cosC );
72 assert ( R.
xy() ==-sinC );
73 assert ( R.
xz() == 0 );
74 assert ( R.
yx() == sinC );
75 assert ( R.
yy() == cosC );
76 assert ( R.
yz() == 0 );
77 assert ( R.
zx() == 0 );
78 assert ( R.
zy() == 0 );
79 assert ( R.
zz() == 1 );
87 assert ( std::abs(RR.
xx() - cosA*cosB*cosC + sinA*sinC) <
DEL );
88 assert ( std::abs(RR.
xy() + cosA*cosB*sinC + sinA*cosC) <
DEL );
89 assert ( std::abs(RR.
xz() - cosA*sinB) <
DEL );
90 assert ( std::abs(RR.
yx() - sinA*cosB*cosC - cosA*sinC) <
DEL );
91 assert ( std::abs(RR.
yy() + sinA*cosB*sinC - cosA*cosC) <
DEL );
92 assert ( std::abs(RR.
yz() - sinA*sinB) <
DEL );
93 assert ( std::abs(RR.
zx() + sinB*cosC) <
DEL );
94 assert ( std::abs(RR.
zy() - sinB*sinC) <
DEL );
95 assert ( std::abs(RR.
zz() - cosB) <
DEL );
102 assert ( R(0,0) == R.
xx() );
103 assert ( R(0,1) == R.
xy() );
104 assert ( R(0,2) == R.
xz() );
105 assert ( R(1,0) == R.
yx() );
106 assert ( R(1,1) == R.
yy() );
107 assert ( R(1,2) == R.
yz() );
108 assert ( R(2,0) == R.
zx() );
109 assert ( R(2,1) == R.
zy() );
110 assert ( R(2,2) == R.
zz() );
114 assert ( RR(i,k) == R[i][k] );
122 R = A; R *=
B; R *= C;
126 assert ( std::abs(V.
x()-R.
xx()-2.*R.
xy()-3.*R.
xz()) <
DEL );
127 assert ( std::abs(V.
y()-R.
yx()-2.*R.
yy()-3.*R.
yz()) <
DEL );
128 assert ( std::abs(V.
z()-R.
zx()-2.*R.
zy()-3.*R.
zz()) <
DEL );
131 assert ( std::abs(RR.
xx() - R.
xx()) <
DEL );
132 assert ( std::abs(RR.
xy() - R.
xy()) <
DEL );
133 assert ( std::abs(RR.
xz() - R.
xz()) <
DEL );
134 assert ( std::abs(RR.
yx() - R.
yx()) <
DEL );
135 assert ( std::abs(RR.
yy() - R.
yy()) <
DEL );
136 assert ( std::abs(RR.
yz() - R.
yz()) <
DEL );
137 assert ( std::abs(RR.
zx() - R.
zx()) <
DEL );
138 assert ( std::abs(RR.
zy() - R.
zy()) <
DEL );
139 assert ( std::abs(RR.
zz() - R.
zz()) <
DEL );
144 assert ( std::abs(RR.
xx() - R.
xx()) <
DEL );
145 assert ( std::abs(RR.
xy() - R.
xy()) <
DEL );
146 assert ( std::abs(RR.
xz() - R.
xz()) <
DEL );
147 assert ( std::abs(RR.
yx() - R.
yx()) <
DEL );
148 assert ( std::abs(RR.
yy() - R.
yy()) <
DEL );
149 assert ( std::abs(RR.
yz() - R.
yz()) <
DEL );
150 assert ( std::abs(RR.
zx() - R.
zx()) <
DEL );
151 assert ( std::abs(RR.
zy() - R.
zy()) <
DEL );
152 assert ( std::abs(RR.
zz() - R.
zz()) <
DEL );
157 assert ( RR(i,k) == R[k][i] );
170 double ang=CLHEP::twopi/9.;
175 RR.rotateZ(-(V.
phi()));
176 RR.rotateY(-(V.
theta()));
178 RR.rotateY(V.
theta());
181 assert ( std::abs(RR.
xx() - R.
xx()) <
DEL );
182 assert ( std::abs(RR.
xy() - R.
xy()) <
DEL );
183 assert ( std::abs(RR.
xz() - R.
xz()) <
DEL );
184 assert ( std::abs(RR.
yx() - R.
yx()) <
DEL );
185 assert ( std::abs(RR.
yy() - R.
yy()) <
DEL );
186 assert ( std::abs(RR.
yz() - R.
yz()) <
DEL );
187 assert ( std::abs(RR.
zx() - R.
zx()) <
DEL );
188 assert ( std::abs(RR.
zy() - R.
zy()) <
DEL );
189 assert ( std::abs(RR.
zz() - R.
zz()) <
DEL );
192 R.getAngleAxis(ang, V);
193 assert ( std::abs(ang - CLHEP::twopi/9.) <
DEL );
194 assert ( std::abs(V.
x() - Vu.
x()) <
DEL );
195 assert ( std::abs(V.
y() - Vu.
y()) <
DEL );
196 assert ( std::abs(V.
z() - Vu.
z()) <
DEL );
198 assert ( std::abs(RR.phiX()-std::atan2(RR.
yx(),RR.
xx())) <
DEL );
199 assert ( std::abs(RR.phiY()-std::atan2(RR.
yy(),RR.
xy())) <
DEL );
200 assert ( std::abs(RR.phiZ()-std::atan2(RR.
yz(),RR.
xz())) <
DEL );
202 assert ( std::abs(RR.thetaX()-std::acos(RR.
zx())) <
DEL );
203 assert ( std::abs(RR.thetaY()-std::acos(RR.
zy())) <
DEL );
204 assert ( std::abs(RR.thetaZ()-std::acos(RR.
zz())) <
DEL );
BasicVector3D< T > unit() const