-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpoi.h
More file actions
72 lines (58 loc) · 1.3 KB
/
poi.h
File metadata and controls
72 lines (58 loc) · 1.3 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#pragma once
#include <vector>
#include <algorithm>
using namespace std;
class poi {
public:
vector<float> vals;
vector<float> zero_vec;
vector<float> d_vec;
int n_agents;
int val_dim;
int observing;
bool observed;
bool active;
float x;
float y;
int type;
int couple;
void refresh();
void reset();
void observe(int idx);
void setter(float X, float Y, vector<float> values,int couple_req, int agents,int poi_type);
poi(){};
};
void poi::reset(){
active=1;
observing=0;
observed=0;
fill(d_vec.begin(), d_vec.end(), 0);
}
void poi::observe(int idx){
observing+=1;
d_vec[idx]=1;
}
void poi::refresh(){
if (active){
if (observing>=couple){
active=0;
observed=1;
}
if (observing != couple)
fill(d_vec.begin(), d_vec.end(), 0);
observing=0;
}
}
void poi::setter(float X, float Y, vector<float> values,int couple_req,int agents,int poi_type){
n_agents=agents;
d_vec.resize(n_agents);
type=poi_type;
vals=values;
x=X;
y=Y;
val_dim=values.size();
zero_vec.resize(val_dim);
fill(zero_vec.begin(), zero_vec.end(), 0);
couple=couple_req;
reset();
}