Robot's source code
Dependencies: mbed
Map/Obstacles/Obs_circle.cpp@109:53918ba98306, 2015-05-05 (annotated)
- Committer:
- Jagang
- Date:
- Tue May 05 16:35:53 2015 +0000
- Revision:
- 109:53918ba98306
- Child:
- 123:55e5e9acc541
IA
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Jagang | 109:53918ba98306 | 1 | #include "Obs_circle.h" |
Jagang | 109:53918ba98306 | 2 | |
Jagang | 109:53918ba98306 | 3 | Obs_circle::Obs_circle(float robotRadius, float x, float y, float size):Obstacle(robotRadius) |
Jagang | 109:53918ba98306 | 4 | { |
Jagang | 109:53918ba98306 | 5 | this->x = x; |
Jagang | 109:53918ba98306 | 6 | this->y = y; |
Jagang | 109:53918ba98306 | 7 | this->size2 = size*size; |
Jagang | 109:53918ba98306 | 8 | } |
Jagang | 109:53918ba98306 | 9 | |
Jagang | 109:53918ba98306 | 10 | int Obs_circle::height(float x, float y) |
Jagang | 109:53918ba98306 | 11 | { |
Jagang | 109:53918ba98306 | 12 | float d = (x-this->x)*(x-this->x) + (y-this->y)*(y-this->y); |
Jagang | 109:53918ba98306 | 13 | if(d <= size2) // On est dans le cercle |
Jagang | 109:53918ba98306 | 14 | { |
Jagang | 109:53918ba98306 | 15 | return 32000; // Interdit |
Jagang | 109:53918ba98306 | 16 | } |
Jagang | 109:53918ba98306 | 17 | else if(bigShape && d <= size2+robotRadius*robotRadius) // On est dans le grand cercle |
Jagang | 109:53918ba98306 | 18 | { |
Jagang | 109:53918ba98306 | 19 | if(!smoothBigShape) |
Jagang | 109:53918ba98306 | 20 | return 32000; // Interdit |
Jagang | 109:53918ba98306 | 21 | else |
Jagang | 109:53918ba98306 | 22 | { |
Jagang | 109:53918ba98306 | 23 | return 32000; // Interdit |
Jagang | 109:53918ba98306 | 24 | } |
Jagang | 109:53918ba98306 | 25 | } |
Jagang | 109:53918ba98306 | 26 | return 0; |
Jagang | 109:53918ba98306 | 27 | } |