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