Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Timer by
Map/Obstacles/Obs_rect.cpp@11:9c70a7f4d7aa, 2016-01-05 (annotated)
- Committer:
- IceTeam
- Date:
- Tue Jan 05 15:48:25 2016 +0100
- Revision:
- 11:9c70a7f4d7aa
Ajout du fichier parent
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 | } |
