ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrapezoidVolumeBoundsTests.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrapezoidVolumeBoundsTests.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2019 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
9 #include <boost/test/unit_test.hpp>
10 
18 
19 namespace tt = boost::test_tools;
20 
21 namespace Acts {
22 
23 namespace Test {
24 BOOST_AUTO_TEST_SUITE(Volumes)
25 
26 BOOST_AUTO_TEST_CASE(bounding_box_creation) {
27  float tol = 1e-4;
28 
29  TrapezoidVolumeBounds tvb(5, 10, 8, 4);
30 
31  auto bb = tvb.boundingBox();
32  CHECK_CLOSE_ABS(bb.max(), Vector3D(10, 8, 4), tol);
33  CHECK_CLOSE_ABS(bb.min(), Vector3D(-10, -8, -4), tol);
34 
35  Transform3D trf;
36 
37  trf = Translation3D(Vector3D(0, 30, 20));
38 
39  bb = tvb.boundingBox(&trf);
40  CHECK_CLOSE_ABS(bb.max(), Vector3D(10, 38, 24), tol);
41  CHECK_CLOSE_ABS(bb.min(), Vector3D(-10, 22, 16), tol);
42 
43  trf = AngleAxis3D(M_PI / 2., Vector3D(-2, 4, 5).normalized());
44 
45  bb = tvb.boundingBox(&trf);
46  CHECK_CLOSE_ABS(bb.max(), Vector3D(9.32577, 11.4906, 11.5777), tol);
47  CHECK_CLOSE_ABS(bb.min(), Vector3D(-9.77021, -8.65268, -9.23688), tol);
48 }
49 
50 BOOST_AUTO_TEST_SUITE_END()
51 
52 } // namespace Test
53 
54 } // namespace Acts