43 {
44
45
46
57
59
60
61
62 std::cin >> d0;
if ( !
test(d0, 1.1, 2.2, 3.3,
DEPS) )
exit(1);
63 std::cin >> f0;
if ( !
test(f0, 3.0, 2.0, 1.0,
FEPS) )
exit(1);
64 std::cout << d0 << std::endl;
65 std::cout << f0 << std::endl;
66
67
68
73
74
75
76 d4 = d1 + d2;
if ( !
test(d4, 2.0, 1.0, 0.0,
DEPS) )
exit(3);
77 d4 = f1 + d2;
if ( !
test(d4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
78 d4 = d1 + f2;
if ( !
test(d4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
79 d4 = f1 + f2;
if ( !
test(d4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
82 f4 = d1 + d2;
if ( !
test(f4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
83 f4 = f1 + d2;
if ( !
test(f4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
84 f4 = d1 + f2;
if ( !
test(f4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
85 f4 = f1 + f2;
if ( !
test(f4, 2.0, 1.0, 0.0,
FEPS) )
exit(3);
88
89
90
95 d4 = d1 - d2;
if ( !
test(d4, 0.0, -1.0, 0.0,
DEPS) )
exit(4);
96 d4 = f1 - d2;
if ( !
test(d4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
97 d4 = d1 - f2;
if ( !
test(d4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
98 d4 = f1 - f2;
if ( !
test(d4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
99 f4 = d1 - d2;
if ( !
test(f4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
100 f4 = f1 - d2;
if ( !
test(f4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
101 f4 = d1 - f2;
if ( !
test(f4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
102 f4 = f1 - f2;
if ( !
test(f4, 0.0, -1.0, 0.0,
FEPS) )
exit(4);
103
104
105
110
111
112
123
124
125
142 d4 = d1.cross(d2);
if ( !
test(d4, 0.0, 0.0, 1.0,
DEPS) )
exit(7);
143 d4 = d2.cross(d1);
if ( !
test(d4, 0.0, 0.0, -1.0,
DEPS) )
exit(7);
144 f4 = f1.cross(d2);
if ( !
test(f4, 0.0, 0.0, 1.0,
FEPS) )
exit(7);
145 f4 = d2.cross(f1);
if ( !
test(f4, 0.0, 0.0, -1.0,
FEPS) )
exit(7);
146
147
148
149 d4 = d1 + f2 + d3;
150 f4 = d1 + f2 + d3;
159
160
161
162 d4 = d2 - 2.0 * d1;
163 f4 = d2 - 2.0f * f1;
170 if ( !
approx((-d2).phi(), -3.0*CLHEP::halfpi*0.5,
DEPS) )
exit(9);
172
179 if ( !
approx((-f2).phi(), -3.0*CLHEP::halfpi*0.5,
FEPS) )
exit(9);
181
182 d4 = d3 - d1;
if ( !
approx(d4.theta(), CLHEP::halfpi*0.5,
DEPS) )
exit(9);
183 if ( !
approx((-d4).theta(), 3.0*CLHEP::halfpi*0.5,
DEPS) )
exit(9);
189 f4 = d3 - d1;
if ( !
approx(f4.theta(), CLHEP::halfpi*0.5,
FEPS) )
exit(9);
190 if ( !
approx((-f4).theta(), 3.0*CLHEP::halfpi*0.5,
FEPS) )
exit(9);
196
197 d4 = d2 - 2.0*d1;
if ( !
approx(d4.angle(d2), CLHEP::halfpi,
DEPS) )
exit(9);
198 f4 = d2 - 2.0*d1;
if ( !
approx(f4.angle(f2), CLHEP::halfpi,
FEPS) )
exit(9);
199
200
201
202 d4 = d1;
203 d4.rotateZ(CLHEP::halfpi);
if ( !
test(d4, 0.0, 1.0, 0.0,
DEPS) )
exit(10);
204 d4.rotateY(25.3);
if ( !
test(d4, 0.0, 1.0, 0.0,
DEPS) )
exit(10);
205 d4.rotateZ(CLHEP::halfpi);
if ( !
test(d4, -1.0, 0.0, 0.0,
DEPS) )
exit(10);
206 d4.rotateY(CLHEP::halfpi);
if ( !
test(d4, 0.0, 0.0, 1.0,
DEPS) )
exit(10);
207 d4.rotateZ(2.6);
if ( !
test(d4, 0.0, 0.0, 1.0,
DEPS) )
exit(10);
208 d4.rotateY(CLHEP::pi*0.25);
209 if ( !
test(d4, std::sqrt(0.5), 0.0, std::sqrt(0.5),
DEPS) )
exit(10);
210 f4 = f1;
211 f4.rotateZ(CLHEP::halfpi);
if ( !
test(f4, 0.0, 1.0, 0.0,
FEPS) )
exit(10);
212 f4.rotateY(25.3);
if ( !
test(f4, 0.0, 1.0, 0.0,
FEPS) )
exit(10);
213 f4.rotateZ(CLHEP::halfpi);
if ( !
test(f4, -1.0, 0.0, 0.0,
FEPS) )
exit(10);
214 f4.rotateY(CLHEP::halfpi);
if ( !
test(f4, 0.0, 0.0, 1.0,
FEPS) )
exit(10);
215 f4.rotateZ(2.6);
if ( !
test(f4, 0.0, 0.0, 1.0,
FEPS) )
exit(10);
216 f4.rotateY(CLHEP::pi*0.25);
217 if ( !
test(f4, std::sqrt(0.5), 0.0, std::sqrt(0.5),
FEPS) )
exit(10);
218
219 d4 = d1;
220 d4.rotate(d4.angle(d3), d4.cross(d3));
221 d4 *= d3.mag();
223 d4 = d1;
224 d4.rotate(0.23, d4.cross(d3));
226 f4 = d1;
227 f4.rotate(f4.angle(d3), f4.cross(d3));
228 f4 *= f3.mag();
230 f4 = f1;
231 f4.rotate(0.23, f4.cross(d3));
234
235
236
237 d4 = d1;
238
242 r4.
rotate(d4.angle(d3), d4.cross(d3));
243 r5.
rotate(0.23, d4.cross(d3));
246 d4 = r5 * d3;
250 f4 = r5 * d3;
253 d4 = d3;
255 d4 *= r1;
256 d4 *= r2;
259 d4 = r5 * d4;
263 d4 = d3.unit();
264 d4 *= d3.mag();
265 if ( !
test(d4, d3.x(), d3.y(), d3.z(),
DEPS) )
exit(11);
266 r0.
rotate(0.10, d1.cross(d3));
267 d1 *= r0;
270
271 return 0;
272
273}
HepRotation inverse() const
HepRotation & rotate(double delta, const Hep3Vector &axis)
HepRotation & rotateZ(double delta)
HepRotation & rotateY(double delta)
bool test(const Hep3Vector &p, double x, double y, double z, double eps)
bool approx(double a, double b, double eps)