Voili voilou

Dependencies:   RoboClaw StepperMotor mbed

Fork of Robot2016_2-0 by ARES

Committer:
IceTeam
Date:
Wed Apr 20 13:13:37 2016 +0000
Revision:
46:8eae88c45a78
Mise en static;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IceTeam 46:8eae88c45a78 1 #ifndef POINTPARCOURS_H
IceTeam 46:8eae88c45a78 2 #define POINTPARCOURS_H
IceTeam 46:8eae88c45a78 3 #include "math.h"
IceTeam 46:8eae88c45a78 4
IceTeam 46:8eae88c45a78 5 #include "controle.h"
IceTeam 46:8eae88c45a78 6 #include "point.h"
IceTeam 46:8eae88c45a78 7
IceTeam 46:8eae88c45a78 8 typedef struct PP4 PointsParc4;
IceTeam 46:8eae88c45a78 9
IceTeam 46:8eae88c45a78 10 class pointParcours : public point {
IceTeam 46:8eae88c45a78 11 public:
IceTeam 46:8eae88c45a78 12 pointParcours (float nx, float ny, pointParcours * npere, point arr) : point (nx, ny) {
IceTeam 46:8eae88c45a78 13 if (npere != NULL)
IceTeam 46:8eae88c45a78 14 G2 = sqrt(npere->getG2() + calculDistance2 (nx, ny, npere->getX(), npere->getY ()));
IceTeam 46:8eae88c45a78 15 else
IceTeam 46:8eae88c45a78 16 G2 = 0;
IceTeam 46:8eae88c45a78 17 pere = npere;
IceTeam 46:8eae88c45a78 18 H2 = sqrt (calculDistance2 (nx, ny, arr.getX (), arr.getY ()));
IceTeam 46:8eae88c45a78 19 }
IceTeam 46:8eae88c45a78 20
IceTeam 46:8eae88c45a78 21 pointParcours (point p, pointParcours * npere, point arr) : point (p) {
IceTeam 46:8eae88c45a78 22 if (pere != NULL)
IceTeam 46:8eae88c45a78 23 G2 = npere->getG2 () + calculDistance2 (p.getX(), p.getY(), npere->getX (), npere->getY ());
IceTeam 46:8eae88c45a78 24 else
IceTeam 46:8eae88c45a78 25 G2 = 0;
IceTeam 46:8eae88c45a78 26 pere = npere;
IceTeam 46:8eae88c45a78 27
IceTeam 46:8eae88c45a78 28 H2 = sqrt(calculDistance2 (p.getX (), p.getY (), arr.getX (), arr.getY ()));
IceTeam 46:8eae88c45a78 29 }
IceTeam 46:8eae88c45a78 30
IceTeam 46:8eae88c45a78 31 pointParcours * getPere () { return pere; }
IceTeam 46:8eae88c45a78 32
IceTeam 46:8eae88c45a78 33 long double getG2 () { return G2; }
IceTeam 46:8eae88c45a78 34 long double getH2 () { return H2; }
IceTeam 46:8eae88c45a78 35 long double getP2 () { return G2 + H2; }
IceTeam 46:8eae88c45a78 36
IceTeam 46:8eae88c45a78 37 bool operator==(pointParcours& a) {
IceTeam 46:8eae88c45a78 38 // Autre version : return (x == a.getX () && y == a.getY () && a.getP2 () == G2 + H2);
IceTeam 46:8eae88c45a78 39 return (x == a.getX () && y == a.getY ());
IceTeam 46:8eae88c45a78 40 }
IceTeam 46:8eae88c45a78 41
IceTeam 46:8eae88c45a78 42 bool operator==(point& a) {
IceTeam 46:8eae88c45a78 43 return (x == a.getX () && y == a.getY ());
IceTeam 46:8eae88c45a78 44 }
IceTeam 46:8eae88c45a78 45
IceTeam 46:8eae88c45a78 46 protected:
IceTeam 46:8eae88c45a78 47 pointParcours * pere;
IceTeam 46:8eae88c45a78 48 long double G2, H2;
IceTeam 46:8eae88c45a78 49 };
IceTeam 46:8eae88c45a78 50
IceTeam 46:8eae88c45a78 51 struct PP4 {
IceTeam 46:8eae88c45a78 52 pointParcours p0;
IceTeam 46:8eae88c45a78 53 pointParcours p1;
IceTeam 46:8eae88c45a78 54 pointParcours p2;
IceTeam 46:8eae88c45a78 55 pointParcours p3;
IceTeam 46:8eae88c45a78 56 };
IceTeam 46:8eae88c45a78 57
IceTeam 46:8eae88c45a78 58 #endif