forked from rishabh1b/RealTimePathPlanning
-
Notifications
You must be signed in to change notification settings - Fork 4
/
obstacle.h
78 lines (77 loc) · 1.7 KB
/
obstacle.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include"simulationParam.h"
class obstacles
{
public:
obstacles();
obstacles(ofVec2f loc);
~obstacles();
#ifdef automatic
virtual void move(std::list<obstacles*> obst);
virtual void applyForce(ofVec2f force);
virtual void update();
virtual ofVec2f repulsive(obstacles *obst);
#endif // automatic
virtual void render();
virtual ofVec2f loc(){ return location; }
virtual float rad() { return radius; }
float getX() { return location.x;}
float getY() { return location.y;}
virtual bool isCircle() { return true; }
virtual bool isCollide(ofVec2f, ofVec2f);
virtual bool isInside(ofVec2f);
float mass;
private:
ofVec2f location,velocity,accelaration;
float radius;
ofColor color;
};
class movingObst : public obstacles
{
public:
movingObst();
~movingObst();
void render();
#ifdef manual
void move(char key);
#endif // manual
#ifdef automatic
void move(std::list<obstacles*> obst);
#endif // automatic
ofVec2f loc() { return this->location; }
float rad() { return this->radius; }
bool isCircle() { return true; }
bool isCollide(ofVec2f, ofVec2f);
bool isInside(ofVec2f);
void applyForce(ofVec2f force);
void update();
ofVec2f repulsive(obstacles *obst);
private:
ofVec2f location, accelaration;
float radius;
ofColor color;
float maxVal;
#ifdef automatic
ofVec2f velocity;
#endif // automatic
};
class maze:public obstacles
{
public:
maze(ofVec2f loc);
maze(ofVec2f loc, float width, float height);
~maze();
void render();
#ifdef automatic
void move(std::list<obstacles*> obst);
#endif
ofVec2f loc();
bool isCircle() { return false; }
bool isCollide(ofVec2f p1, ofVec2f p2);
bool isInside(ofVec2f p);
private:
ofColor color;
ofVec2f location;
float width, height;
ofRectangle rect;
};