Ocean
TestBox3.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  *
4  * This source code is licensed under the MIT license found in the
5  * LICENSE file in the root directory of this source tree.
6  */
7 
8 #ifndef META_OCEAN_TEST_TESTMATH_TEST_BOX3_H
9 #define META_OCEAN_TEST_TESTMATH_TEST_BOX3_H
10 
12 
13 #include "ocean/math/Box3.h"
14 #include "ocean/math/Line3.h"
15 
16 namespace Ocean
17 {
18 
19 namespace Test
20 {
21 
22 namespace TestMath
23 {
24 
25 /**
26  * This class implements box tests.
27  * @ingroup testmath
28  */
29 class OCEAN_TEST_MATH_EXPORT TestBox3
30 {
31  public:
32 
33  /**
34  * Tests the entire box functionalities.
35  * @param testDuration Duration of each test, with range (0, infinity)
36  * @return True, if succeeded
37  */
38  static bool test(const double testDuration);
39 
40  /**
41  * Point test.
42  * @param testDuration Duration of each test, with range (0, infinity)
43  * @return True, if succeeded
44  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
45  */
46  template <typename T>
47  static bool testPoint(const double testDuration);
48 
49  /**
50  * Is inside test.
51  * @param testDuration Duration of each test, with range (0, infinity)
52  * @return True, if succeeded
53  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
54  */
55  template <typename T>
56  static bool testIsInside(const double testDuration);
57 
58  /**
59  * Addition test.
60  * @param testDuration Duration of each test, with range (0, infinity)
61  * @return True, if succeeded
62  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
63  */
64  template <typename T>
65  static bool testAddition(const double testDuration);
66 
67  /**
68  * Transformation test.
69  * @param testDuration Duration of each test, with range (0, infinity)
70  * @return True, if succeeded
71  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
72  */
73  template <typename T>
74  static bool testTransformation(const double testDuration);
75 
76  /**
77  * Line test.
78  * @param testDuration Duration of each test, with range (0, infinity)
79  * @return True, if succeeded
80  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
81  */
82  template <typename T>
83  static bool testLine(const double testDuration);
84 
85  /**
86  * Plane test.
87  * @param testDuration Duration of each test, with range (0, infinity)
88  * @return True, if succeeded
89  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
90  */
91  template <typename T>
92  static bool testPlane(const double testDuration);
93 
94  /**
95  * Space test.
96  * @param testDuration Duration of each test, with range (0, infinity)
97  * @return True, if succeeded
98  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
99  */
100  template <typename T>
101  static bool testSpace(const double testDuration);
102 
103  /**
104  * Has intersection test.
105  * @param testDuration Duration of each test, with range (0, infinity)
106  * @return True, if succeeded
107  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
108  */
109  template <typename T>
110  static bool testHasIntersection(const double testDuration);
111 
112  /**
113  * Tests the expand function.
114  * @param testDuration Duration of each test, with range (0, infinity)
115  * @return True, if succeeded
116  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
117  */
118  template <typename T>
119  static bool testExpand(const double testDuration);
120 
121  private:
122 
123  /**
124  * Validate has intersection test.
125  * @param testDuration Duration of each test, with range (0, infinity)
126  * @return True, if succeeded
127  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
128  */
129  template <typename T>
130  static bool validateHasIntersection(const double testDuration);
131 
132  /**
133  * Returns whether a ray has an intersection with a given box or not.
134  * @param box Box to be tested
135  * @param line Line to be tested
136  * @return True, if so
137  * @tparam T The data type of the scalar to be used for testing, either 'float' or 'double'
138  */
139  template <typename T>
140  static bool hasIntersection(const BoxT3<T>& box, const LineT3<T>& line);
141 };
142 
143 }
144 
145 }
146 
147 }
148 
149 #endif // META_OCEAN_TEST_TESTMATH_TEST_BOX3_H
This class implements an axis aligned 3D bounding box.
Definition: Box3.h:67
This class implements an infinite line in 3D space.
Definition: Line3.h:70
This class implements box tests.
Definition: TestBox3.h:30
static bool testIsInside(const double testDuration)
Is inside test.
static bool validateHasIntersection(const double testDuration)
Validate has intersection test.
static bool testPoint(const double testDuration)
Point test.
static bool test(const double testDuration)
Tests the entire box functionalities.
static bool testTransformation(const double testDuration)
Transformation test.
static bool testLine(const double testDuration)
Line test.
static bool testPlane(const double testDuration)
Plane test.
static bool hasIntersection(const BoxT3< T > &box, const LineT3< T > &line)
Returns whether a ray has an intersection with a given box or not.
static bool testSpace(const double testDuration)
Space test.
static bool testAddition(const double testDuration)
Addition test.
static bool testHasIntersection(const double testDuration)
Has intersection test.
static bool testExpand(const double testDuration)
Tests the expand function.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15