Voili voilou
Dependencies: RoboClaw StepperMotor mbed
Fork of Robot2016_2-0 by
Diff: Map/Obstacles/Obs_circle.cpp
- Revision:
- 11:9c70a7f4d7aa
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Map/Obstacles/Obs_circle.cpp Tue Jan 05 15:48:25 2016 +0100 @@ -0,0 +1,30 @@ +#include "Obs_circle.h" + +Obs_circle::Obs_circle(float robotRadius, int id, float x, float y, float size):Obstacle(robotRadius,id) +{ + this->x = x; + this->y = y; + this->size2 = size*size; +} + +int Obs_circle::height(float x, float y) +{ + if(!active) + return 0; + + 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; +}