Voili voilou

Dependencies:   RoboClaw StepperMotor mbed

Fork of Robot2016_2-0 by ARES

Committer:
IceTeam
Date:
Tue Jan 05 15:48:25 2016 +0100
Revision:
11:9c70a7f4d7aa
Ajout du fichier parent

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IceTeam 11:9c70a7f4d7aa 1 #ifndef POINT_H
IceTeam 11:9c70a7f4d7aa 2 #define POINT_H
IceTeam 11:9c70a7f4d7aa 3
IceTeam 11:9c70a7f4d7aa 4 #include <vector>
IceTeam 11:9c70a7f4d7aa 5
IceTeam 11:9c70a7f4d7aa 6 class Point;
IceTeam 11:9c70a7f4d7aa 7
IceTeam 11:9c70a7f4d7aa 8 class Point
IceTeam 11:9c70a7f4d7aa 9 {
IceTeam 11:9c70a7f4d7aa 10 public:
IceTeam 11:9c70a7f4d7aa 11 Point()
IceTeam 11:9c70a7f4d7aa 12 {
IceTeam 11:9c70a7f4d7aa 13 x=y=G=H=0;
IceTeam 11:9c70a7f4d7aa 14 }
IceTeam 11:9c70a7f4d7aa 15
IceTeam 11:9c70a7f4d7aa 16 Point(int x, int y, float G=0, float H=0) : x(x),y(y),G(G),H(H)
IceTeam 11:9c70a7f4d7aa 17 {
IceTeam 11:9c70a7f4d7aa 18
IceTeam 11:9c70a7f4d7aa 19 }
IceTeam 11:9c70a7f4d7aa 20
IceTeam 11:9c70a7f4d7aa 21 virtual ~Point()
IceTeam 11:9c70a7f4d7aa 22 {
IceTeam 11:9c70a7f4d7aa 23
IceTeam 11:9c70a7f4d7aa 24 }
IceTeam 11:9c70a7f4d7aa 25
IceTeam 11:9c70a7f4d7aa 26 Point operator=(const Point &acase)
IceTeam 11:9c70a7f4d7aa 27 {
IceTeam 11:9c70a7f4d7aa 28 x=acase.x;
IceTeam 11:9c70a7f4d7aa 29 y=acase.y;
IceTeam 11:9c70a7f4d7aa 30 G=acase.G;
IceTeam 11:9c70a7f4d7aa 31 H=acase.H;
IceTeam 11:9c70a7f4d7aa 32 p=acase.p;
IceTeam 11:9c70a7f4d7aa 33 return *this;
IceTeam 11:9c70a7f4d7aa 34 }
IceTeam 11:9c70a7f4d7aa 35
IceTeam 11:9c70a7f4d7aa 36 void setx(int xx) { x=xx; }
IceTeam 11:9c70a7f4d7aa 37 void sety(int yy) { y=yy; }
IceTeam 11:9c70a7f4d7aa 38 void setG(float GG) { G=GG; }
IceTeam 11:9c70a7f4d7aa 39 void setH(float HH) { H=HH; }
IceTeam 11:9c70a7f4d7aa 40 void setParent(Point *pp) { p=pp; }
IceTeam 11:9c70a7f4d7aa 41 void setParent() { p=0; }
IceTeam 11:9c70a7f4d7aa 42
IceTeam 11:9c70a7f4d7aa 43 int getx() { return x; }
IceTeam 11:9c70a7f4d7aa 44 int gety() { return y; }
IceTeam 11:9c70a7f4d7aa 45 float getF() { return G+H; }
IceTeam 11:9c70a7f4d7aa 46 float getG() { return G; }
IceTeam 11:9c70a7f4d7aa 47 float getH() { return H; }
IceTeam 11:9c70a7f4d7aa 48 Point* getParent() { return p; }
IceTeam 11:9c70a7f4d7aa 49
IceTeam 11:9c70a7f4d7aa 50
IceTeam 11:9c70a7f4d7aa 51 bool in(std::vector<Point*> &list, unsigned int &pos)
IceTeam 11:9c70a7f4d7aa 52 {
IceTeam 11:9c70a7f4d7aa 53 for(unsigned int i=0;i<list.size();i++)
IceTeam 11:9c70a7f4d7aa 54 if(list[i]->getx() == this->getx() && list[i]->gety() == this->gety())
IceTeam 11:9c70a7f4d7aa 55 {
IceTeam 11:9c70a7f4d7aa 56 pos = i;
IceTeam 11:9c70a7f4d7aa 57 return true;
IceTeam 11:9c70a7f4d7aa 58 }
IceTeam 11:9c70a7f4d7aa 59 return false;
IceTeam 11:9c70a7f4d7aa 60 }
IceTeam 11:9c70a7f4d7aa 61
IceTeam 11:9c70a7f4d7aa 62 bool in(std::vector<Point*> &list)
IceTeam 11:9c70a7f4d7aa 63 {
IceTeam 11:9c70a7f4d7aa 64 for(unsigned int i=0;i<list.size();i++)
IceTeam 11:9c70a7f4d7aa 65 if(list[i]->getx() == this->getx() && list[i]->gety() == this->gety())
IceTeam 11:9c70a7f4d7aa 66 return true;
IceTeam 11:9c70a7f4d7aa 67 return false;
IceTeam 11:9c70a7f4d7aa 68 }
IceTeam 11:9c70a7f4d7aa 69
IceTeam 11:9c70a7f4d7aa 70 private:
IceTeam 11:9c70a7f4d7aa 71 int x;
IceTeam 11:9c70a7f4d7aa 72 int y;
IceTeam 11:9c70a7f4d7aa 73 float G;
IceTeam 11:9c70a7f4d7aa 74 float H;
IceTeam 11:9c70a7f4d7aa 75 Point *p;
IceTeam 11:9c70a7f4d7aa 76 };
IceTeam 11:9c70a7f4d7aa 77
IceTeam 11:9c70a7f4d7aa 78 #endif // POINT_H