Robot's source code

Dependencies:   mbed

Committer:
Jagang
Date:
Mon May 11 20:32:11 2015 +0000
Revision:
123:55e5e9acc541
Parent:
109:53918ba98306
Maj AI; Repositionnement du d?part (1000,177); Ajout de l'action sur les claps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jagang 109:53918ba98306 1 #include "Obs_rect.h"
Jagang 109:53918ba98306 2
Jagang 123:55e5e9acc541 3 Obs_rect::Obs_rect(float robotRadius, int id, float x1, float y1, float x2, float y2):Obstacle(robotRadius,id)
Jagang 109:53918ba98306 4 {
Jagang 109:53918ba98306 5 this->x1 = (x1<x2) ? x1:x2;
Jagang 109:53918ba98306 6 this->x2 = (x1<x2) ? x2:x1;
Jagang 109:53918ba98306 7 this->y1 = (y1<y2) ? y1:y2;
Jagang 109:53918ba98306 8 this->y2 = (y1<y2) ? y2:y1;
Jagang 109:53918ba98306 9 }
Jagang 109:53918ba98306 10
Jagang 109:53918ba98306 11 int Obs_rect::height(float x, float y)
Jagang 109:53918ba98306 12 {
Jagang 123:55e5e9acc541 13 if(!active)
Jagang 123:55e5e9acc541 14 return 0;
Jagang 109:53918ba98306 15 if(bigShape)
Jagang 109:53918ba98306 16 {
Jagang 109:53918ba98306 17 if(x1 - robotRadius < x && x < x2 + robotRadius && y1 - robotRadius < y && y < y2 + robotRadius)
Jagang 109:53918ba98306 18 return 32000; // Dans le grand rctangle
Jagang 109:53918ba98306 19 }
Jagang 109:53918ba98306 20 else
Jagang 109:53918ba98306 21 {
Jagang 109:53918ba98306 22 if(x1 < x && x < x2 && y1 < y && y < y2)
Jagang 109:53918ba98306 23 return 32000; // Dans le petit rectangle
Jagang 109:53918ba98306 24 }
Jagang 109:53918ba98306 25 return 0;
Jagang 109:53918ba98306 26 }