Robot's source code
Dependencies: mbed
Diff: Map/Obstacles/Obs_circle.cpp
- Revision:
- 109:53918ba98306
- Child:
- 123:55e5e9acc541
diff -r 6a38cc0765f5 -r 53918ba98306 Map/Obstacles/Obs_circle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Map/Obstacles/Obs_circle.cpp Tue May 05 16:35:53 2015 +0000 @@ -0,0 +1,27 @@ +#include "Obs_circle.h" + +Obs_circle::Obs_circle(float robotRadius, float x, float y, float size):Obstacle(robotRadius) +{ + this->x = x; + this->y = y; + this->size2 = size*size; +} + +int Obs_circle::height(float x, float y) +{ + float d = (x-this->x)*(x-this->x) + (y-this->y)*(y-this->y); + if(d <= size2) // On est dans le cercle + { + return 32000; // Interdit + } + else if(bigShape && d <= size2+robotRadius*robotRadius) // On est dans le grand cercle + { + if(!smoothBigShape) + return 32000; // Interdit + else + { + return 32000; // Interdit + } + } + return 0; +}