Voili voilou
Dependencies: RoboClaw StepperMotor mbed
Fork of Robot2016_2-0 by
Map/Obstacles/Obs_rect.cpp@45:b53ae54062c6, 2016-04-13 (annotated)
- Committer:
- sype
- Date:
- Wed Apr 13 12:47:47 2016 +0000
- Revision:
- 45:b53ae54062c6
- Parent:
- 11:9c70a7f4d7aa
Impl?mentation des dispositifs finie
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
IceTeam | 11:9c70a7f4d7aa | 1 | #include "Obs_rect.h" |
IceTeam | 11:9c70a7f4d7aa | 2 | |
IceTeam | 11:9c70a7f4d7aa | 3 | Obs_rect::Obs_rect(float robotRadius, int id, float x1, float y1, float x2, float y2):Obstacle(robotRadius,id) |
IceTeam | 11:9c70a7f4d7aa | 4 | { |
IceTeam | 11:9c70a7f4d7aa | 5 | this->x1 = (x1<x2) ? x1:x2; |
IceTeam | 11:9c70a7f4d7aa | 6 | this->x2 = (x1<x2) ? x2:x1; |
IceTeam | 11:9c70a7f4d7aa | 7 | this->y1 = (y1<y2) ? y1:y2; |
IceTeam | 11:9c70a7f4d7aa | 8 | this->y2 = (y1<y2) ? y2:y1; |
IceTeam | 11:9c70a7f4d7aa | 9 | } |
IceTeam | 11:9c70a7f4d7aa | 10 | |
IceTeam | 11:9c70a7f4d7aa | 11 | int Obs_rect::height(float x, float y) |
IceTeam | 11:9c70a7f4d7aa | 12 | { |
IceTeam | 11:9c70a7f4d7aa | 13 | if(!active) |
IceTeam | 11:9c70a7f4d7aa | 14 | return 0; |
IceTeam | 11:9c70a7f4d7aa | 15 | if(bigShape) |
IceTeam | 11:9c70a7f4d7aa | 16 | { |
IceTeam | 11:9c70a7f4d7aa | 17 | if(x1 - robotRadius < x && x < x2 + robotRadius && y1 - robotRadius < y && y < y2 + robotRadius) |
IceTeam | 11:9c70a7f4d7aa | 18 | return 32000; // Dans le grand rctangle |
IceTeam | 11:9c70a7f4d7aa | 19 | } |
IceTeam | 11:9c70a7f4d7aa | 20 | else |
IceTeam | 11:9c70a7f4d7aa | 21 | { |
IceTeam | 11:9c70a7f4d7aa | 22 | if(x1 < x && x < x2 && y1 < y && y < y2) |
IceTeam | 11:9c70a7f4d7aa | 23 | return 32000; // Dans le petit rectangle |
IceTeam | 11:9c70a7f4d7aa | 24 | } |
IceTeam | 11:9c70a7f4d7aa | 25 | return 0; |
IceTeam | 11:9c70a7f4d7aa | 26 | } |