@@ -35,6 +35,8 @@ enum class material_ids : unsigned int {
35
35
36
36
constexpr detray::test::scalar tol{5e-5f };
37
37
38
+ detray::dvector3D<detray::test::algebra> test_dir{0 .f , 0 .f , 1 .f };
39
+
38
40
} // anonymous namespace
39
41
40
42
// This tests the construction of a surface descriptor object
@@ -160,17 +162,17 @@ GTEST_TEST(detray_geometry, surface_toy_detector) {
160
162
161
163
// Coordinate transformations
162
164
point3 glob_pos = {4 .f , 7 .f , 4 .f };
163
- point3 local = disc.global_to_local (ctx, glob_pos, {} );
164
- point2 bound = disc.global_to_bound (ctx, glob_pos, {} );
165
+ point3 local = disc.global_to_local (ctx, glob_pos, test_dir );
166
+ point2 bound = disc.global_to_bound (ctx, glob_pos, test_dir );
165
167
166
168
ASSERT_NEAR (local[0 ], std::sqrt (65 .f ), tol);
167
169
ASSERT_NEAR (local[1 ], std::atan2 (7 .f , 4 .f ), tol);
168
170
ASSERT_NEAR (bound[0 ], local[0 ], tol);
169
171
ASSERT_NEAR (bound[1 ], local[1 ], tol);
170
172
171
173
// Roundtrip
172
- point3 global = disc.local_to_global (ctx, local, {} );
173
- point3 global2 = disc.bound_to_global (ctx, bound, {} );
174
+ point3 global = disc.local_to_global (ctx, local, test_dir );
175
+ point3 global2 = disc.bound_to_global (ctx, bound, test_dir );
174
176
175
177
ASSERT_NEAR (glob_pos[0 ], global[0 ], tol);
176
178
ASSERT_NEAR (glob_pos[1 ], global[1 ], tol);
@@ -237,22 +239,22 @@ GTEST_TEST(detray_geometry, surface_toy_detector) {
237
239
// Coordinate transformation roundtrip
238
240
glob_pos = {4 .f , 7 .f , 4 .f };
239
241
240
- local = rec.global_to_local (ctx, glob_pos, {} );
241
- global = rec.local_to_global (ctx, local, {} );
242
+ local = rec.global_to_local (ctx, glob_pos, test_dir );
243
+ global = rec.local_to_global (ctx, local, test_dir );
242
244
ASSERT_NEAR (glob_pos[0 ], global[0 ], tol);
243
245
ASSERT_NEAR (glob_pos[1 ], global[1 ], tol);
244
246
ASSERT_NEAR (glob_pos[2 ], global[2 ], tol);
245
247
246
248
glob_pos = {-71 .902099f , -7 .081735f , -460 .f };
247
249
248
- local = rec.global_to_local (ctx, glob_pos, {} );
249
- global = rec.local_to_global (ctx, local, {} );
250
+ local = rec.global_to_local (ctx, glob_pos, test_dir );
251
+ global = rec.local_to_global (ctx, local, test_dir );
250
252
ASSERT_NEAR (glob_pos[0 ], global[0 ], tol);
251
253
ASSERT_NEAR (glob_pos[1 ], global[1 ], tol);
252
254
ASSERT_NEAR (glob_pos[2 ], global[2 ], tol);
253
255
254
- bound = rec.global_to_bound (ctx, glob_pos, {} );
255
- global = rec.bound_to_global (ctx, bound, {} );
256
+ bound = rec.global_to_bound (ctx, glob_pos, test_dir );
257
+ global = rec.bound_to_global (ctx, bound, test_dir );
256
258
ASSERT_NEAR (global[0 ], glob_pos[0 ], tol);
257
259
ASSERT_NEAR (global[1 ], glob_pos[1 ], tol);
258
260
ASSERT_NEAR (global[2 ], glob_pos[2 ], tol);
@@ -339,23 +341,23 @@ GTEST_TEST(detray_geometry, surface_toy_detector) {
339
341
// Coordinate transformation roundtrip
340
342
glob_pos = {4 .f , 7 .f , 4 .f };
341
343
342
- local = cyl.global_to_local (ctx, glob_pos, {} );
343
- global = cyl.local_to_global (ctx, local, {} );
344
+ local = cyl.global_to_local (ctx, glob_pos, test_dir );
345
+ global = cyl.local_to_global (ctx, local, test_dir );
344
346
ASSERT_NEAR (glob_pos[0 ], global[0 ], tol);
345
347
ASSERT_NEAR (glob_pos[1 ], global[1 ], tol);
346
348
ASSERT_NEAR (glob_pos[2 ], global[2 ], tol);
347
349
348
350
glob_pos = {constant<scalar>::inv_sqrt2 * r,
349
351
constant<scalar>::inv_sqrt2 * r, 2 .f };
350
352
351
- local = cyl.global_to_local (ctx, glob_pos, {} );
352
- global = cyl.local_to_global (ctx, local, {} );
353
+ local = cyl.global_to_local (ctx, glob_pos, test_dir );
354
+ global = cyl.local_to_global (ctx, local, test_dir );
353
355
ASSERT_NEAR (glob_pos[0 ], global[0 ], tol);
354
356
ASSERT_NEAR (glob_pos[1 ], global[1 ], tol);
355
357
ASSERT_NEAR (glob_pos[2 ], global[2 ], tol);
356
358
357
- bound = cyl.global_to_bound (ctx, glob_pos, {} );
358
- global = cyl.bound_to_global (ctx, bound, {} );
359
+ bound = cyl.global_to_bound (ctx, glob_pos, test_dir );
360
+ global = cyl.bound_to_global (ctx, bound, test_dir );
359
361
ASSERT_NEAR (global[0 ], glob_pos[0 ], tol);
360
362
ASSERT_NEAR (global[1 ], glob_pos[1 ], tol);
361
363
ASSERT_NEAR (global[2 ], glob_pos[2 ], tol);
@@ -442,7 +444,7 @@ GTEST_TEST(detray_geometry, surface_wire_chamber) {
442
444
// Coordinate transformation roundtrip
443
445
point3 glob_pos = {4 .f , 7 .f , 4 .f };
444
446
445
- point3 local = line.global_to_local (ctx, glob_pos, dir );
447
+ point3 local = line.global_to_local (ctx, glob_pos, test_dir );
446
448
global = line.local_to_global (ctx, local, dir);
447
449
448
450
// @TODO: Needs a reduced tolerance, why?
@@ -453,15 +455,15 @@ GTEST_TEST(detray_geometry, surface_wire_chamber) {
453
455
454
456
glob_pos = center;
455
457
456
- local = line.global_to_local (ctx, glob_pos, dir );
457
- global = line.local_to_global (ctx, local, dir );
458
+ local = line.global_to_local (ctx, glob_pos, test_dir );
459
+ global = line.local_to_global (ctx, local, test_dir );
458
460
red_tol = 7 .f * 1e-5f ;
459
461
ASSERT_NEAR (glob_pos[0 ], global[0 ], red_tol);
460
462
ASSERT_NEAR (glob_pos[1 ], global[1 ], red_tol);
461
463
ASSERT_NEAR (glob_pos[2 ], global[2 ], red_tol);
462
464
463
- point2 bound = line.global_to_bound (ctx, glob_pos, dir );
464
- global = line.bound_to_global (ctx, bound, dir );
465
+ point2 bound = line.global_to_bound (ctx, glob_pos, test_dir );
466
+ global = line.bound_to_global (ctx, bound, test_dir );
465
467
ASSERT_NEAR (global[0 ], glob_pos[0 ], red_tol);
466
468
ASSERT_NEAR (global[1 ], glob_pos[1 ], red_tol);
467
469
ASSERT_NEAR (global[2 ], glob_pos[2 ], red_tol);
0 commit comments