-
Notifications
You must be signed in to change notification settings - Fork 3
/
Environment.h
46 lines (38 loc) · 1.02 KB
/
Environment.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
#ifndef ENVIRONMENT_H
#define ENVIRONMENT_H
#include <iostream>
#include <random>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace std;
using namespace cv;
class Environment
{
private:
Point goal;
public:
Environment();
auto getGoal(){return goal;}
void Update( vector <vector<double> > );
};
Environment::Environment()
{
// Create A Random Goal
mt19937 mersenne( static_cast<unsigned int>( time( nullptr ) ) );
uniform_real_distribution<> rndx( 8, 632 );
uniform_real_distribution<> rndy( 8, 472 );
goal.x = rndx(mersenne);
goal.y = rndy(mersenne);
}
void Environment::Update( vector <vector<double> > particles )
{
Mat Env( 480, 640, CV_8UC3, Scalar(0, 0, 0) );
circle( Env, goal, 8.0, Scalar( 0, 255, 0 ), -1, 8 );
for( int i = 0; i < particles.size(); i++ )
{
circle( Env, Point2d( particles[i][0], particles[i][1] ), 8.0, Scalar( 255, 255, 255 ), -1, 8 );
}
imshow("Environment", Env);
waitKey(300);
}
#endif