Robot's source code

Dependencies:   mbed

Committer:
Jagang
Date:
Tue May 05 16:35:53 2015 +0000
Revision:
109:53918ba98306
Child:
123:55e5e9acc541
IA

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jagang 109:53918ba98306 1 #include "Obs_rect.h"
Jagang 109:53918ba98306 2
Jagang 109:53918ba98306 3 Obs_rect::Obs_rect(float robotRadius, float x1, float y1, float x2, float y2):Obstacle(robotRadius)
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 109:53918ba98306 13 if(bigShape)
Jagang 109:53918ba98306 14 {
Jagang 109:53918ba98306 15 if(x1 - robotRadius < x && x < x2 + robotRadius && y1 - robotRadius < y && y < y2 + robotRadius)
Jagang 109:53918ba98306 16 return 32000; // Dans le grand rctangle
Jagang 109:53918ba98306 17 }
Jagang 109:53918ba98306 18 else
Jagang 109:53918ba98306 19 {
Jagang 109:53918ba98306 20 if(x1 < x && x < x2 && y1 < y && y < y2)
Jagang 109:53918ba98306 21 return 32000; // Dans le petit rectangle
Jagang 109:53918ba98306 22 }
Jagang 109:53918ba98306 23 return 0;
Jagang 109:53918ba98306 24 }