-
Notifications
You must be signed in to change notification settings - Fork 83
/
test_random_point.h
50 lines (39 loc) · 1.25 KB
/
test_random_point.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// This file is part of KWIVER, and is distributed under the
// OSI-approved BSD 3-Clause License. See top-level LICENSE file or
// https://github.com/Kitware/kwiver/blob/master/LICENSE for details.
/**
* \file
*
* \brief Functions for creating test points with added random Gaussian noise.
*
*/
#ifndef ALGORITHMS_TEST_TEST_RANDOM_POINT_H_
#define ALGORITHMS_TEST_TEST_RANDOM_POINT_H_
#include <vital/vital_config.h>
#include <vital/types/vector.h>
#include <random>
namespace kwiver {
namespace testing {
/// random number generator type
typedef std::mt19937 rng_t;
/// normal distribution
typedef std::normal_distribution<> norm_dist_t;
// ------------------------------------------------------------------
inline
kwiver::vital::vector_3d random_point3d( double stdev, rng_t& rng )
{
norm_dist_t norm( 0.0, stdev );
kwiver::vital::vector_3d v( norm( rng ), norm( rng ), norm( rng ) );
return v;
}
// ------------------------------------------------------------------
inline
kwiver::vital::vector_2d random_point2d( double stdev, rng_t& rng )
{
norm_dist_t norm( 0.0, stdev );
kwiver::vital::vector_2d v( norm( rng ), norm( rng ) );
return v;
}
} // end namespace testing
} // end namespace kwiver
#endif // ALGORITHMS_TEST_TEST_RANDOM_POINT_H_