Ocean
TestP3P.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_TESTGEOMETRY_TEST_P3P_H
9 #define META_OCEAN_TEST_TESTGEOMETRY_TEST_P3P_H
10 
12 
14 
15 #include "ocean/math/Random.h"
16 
17 namespace Ocean
18 {
19 
20 namespace Test
21 {
22 
23 namespace TestGeometry
24 {
25 
26 /**
27  * This class implements a P3P test.
28  * @ingroup testgeometry
29  */
30 class OCEAN_TEST_GEOMETRY_EXPORT TestP3P
31 {
32  public:
33 
34  /**
35  * Invokes all tests for the perspective pose problem for three points.
36  * @param testDuration Number of seconds for each test, with range (0, infinity)
37  * @return True, if succeeded
38  */
39  static bool test(const double testDuration);
40 
41  /**
42  * Tests the perspective pose problem for three image points and any camera.
43  * @param testDuration Number of seconds for each test, with range (0, infinity)
44  * @return True, if succeeded
45  * @tparam T The floating point data type to be used for testing
46  */
47  template <typename T>
48  static bool testP3PWithPoints(const double testDuration);
49 
50  /**
51  * Tests the perspective pose problem for three rays.
52  * @param testDuration Number of seconds for each test, with range (0, infinity)
53  * @return True, if succeeded
54  * @tparam T The floating point data type to be used for testing
55  */
56  template <typename T>
57  static bool testP3PWithRays(const double testDuration);
58 
59  /**
60  * Tests whether the perspective pose problem for three points does not crash and whether basic requirements hold.
61  * This test simply creates random data without any meaning and invokes the function to ensure that the function never crashes.
62  * @param testDuration Number of seconds for each test, with range (0, infinity)
63  * @return True, if succeeded
64  * @tparam T The floating point data type to be used for testing
65  */
66  template <typename T>
67  static bool testP3PWithPointsStressTest(const double testDuration);
68 
69  /**
70  * Tests whether the perspective pose problem for three rays does not crash.
71  * This test simply creates random data without any meaning and invokes the function to ensure that the function never crashes.
72  * @param testDuration Number of seconds for each test, with range (0, infinity)
73  * @return True, if succeeded
74  * @tparam T The floating point data type to be used for testing
75  */
76  template <typename T>
77  static bool testP3PWithRaysStressTest(const double testDuration);
78 
79  private:
80 
81  /**
82  * Creates a random 3D vector fitting into a 3D bounding box of size 20,000 x 20,000 x 20,000.
83  * @param randomGenerator The random generator object to be used
84  * @return The random 3D vector, with range [-10000, 10000]x[-10000, 10000]x[-10000, 10000]
85  * @tparam T The data type of each element
86  */
87  template <typename T>
88  static VectorT3<T> randomVector(RandomGenerator& randomGenerator);
89 };
90 
91 }
92 
93 }
94 
95 }
96 
97 #endif // META_OCEAN_TEST_TESTGEOMETRY_TEST_P3P_H
This class implements a generator for random numbers.
Definition: RandomGenerator.h:42
This class implements a P3P test.
Definition: TestP3P.h:31
static bool testP3PWithRaysStressTest(const double testDuration)
Tests whether the perspective pose problem for three rays does not crash.
static bool test(const double testDuration)
Invokes all tests for the perspective pose problem for three points.
static bool testP3PWithPoints(const double testDuration)
Tests the perspective pose problem for three image points and any camera.
static VectorT3< T > randomVector(RandomGenerator &randomGenerator)
Creates a random 3D vector fitting into a 3D bounding box of size 20,000 x 20,000 x 20,...
static bool testP3PWithRays(const double testDuration)
Tests the perspective pose problem for three rays.
static bool testP3PWithPointsStressTest(const double testDuration)
Tests whether the perspective pose problem for three points does not crash and whether basic requirem...
This class implements a vector with three elements.
Definition: Vector3.h:97
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15