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.
Dependencies: mbed
Diff: Map/Obstacles/Obs_rect.cpp
- Revision:
- 0:b127c787a51b
diff -r 000000000000 -r b127c787a51b Map/Obstacles/Obs_rect.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Map/Obstacles/Obs_rect.cpp Sun May 24 12:30:47 2015 +0000
@@ -0,0 +1,26 @@
+#include "Obs_rect.h"
+
+Obs_rect::Obs_rect(float robotRadius, int id, float x1, float y1, float x2, float y2):Obstacle(robotRadius,id)
+{
+ this->x1 = (x1<x2) ? x1:x2;
+ this->x2 = (x1<x2) ? x2:x1;
+ this->y1 = (y1<y2) ? y1:y2;
+ this->y2 = (y1<y2) ? y2:y1;
+}
+
+int Obs_rect::height(float x, float y)
+{
+ if(!active)
+ return 0;
+ if(bigShape)
+ {
+ if(x1 - robotRadius < x && x < x2 + robotRadius && y1 - robotRadius < y && y < y2 + robotRadius)
+ return 32000; // Dans le grand rctangle
+ }
+ else
+ {
+ if(x1 < x && x < x2 && y1 < y && y < y2)
+ return 32000; // Dans le petit rectangle
+ }
+ return 0;
+}

