coucou

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Committer:
IceTeam
Date:
Mon Apr 25 12:42:32 2016 +0000
Revision:
46:be4eebf40568
Petit commit de batard;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IceTeam 46:be4eebf40568 1 #include "obsCarr.h"
IceTeam 46:be4eebf40568 2
IceTeam 46:be4eebf40568 3 bool obsCarr::getCroisement (point A, point B) {
IceTeam 46:be4eebf40568 4 point p0 (xcentre - dxtaille, ycentre + dytaille);
IceTeam 46:be4eebf40568 5 point p1 (xcentre + dxtaille, ycentre + dytaille);
IceTeam 46:be4eebf40568 6 point p2 (xcentre - dxtaille, ycentre - dytaille);
IceTeam 46:be4eebf40568 7 point p3 (xcentre + dxtaille, ycentre - dytaille);
IceTeam 46:be4eebf40568 8
IceTeam 46:be4eebf40568 9 if (CroisementSegment (p0, p3, A, B) || CroisementSegment (p1, p2, A, B) || belongs(A) || belongs(B))
IceTeam 46:be4eebf40568 10 return true;
IceTeam 46:be4eebf40568 11 else
IceTeam 46:be4eebf40568 12 return false;
IceTeam 46:be4eebf40568 13 }
IceTeam 46:be4eebf40568 14
IceTeam 46:be4eebf40568 15 bool obsCarr::getCroisement (float X, float Y, point B) {
IceTeam 46:be4eebf40568 16 point A (X, Y);
IceTeam 46:be4eebf40568 17 return getCroisement (A, B);
IceTeam 46:be4eebf40568 18 }
IceTeam 46:be4eebf40568 19
IceTeam 46:be4eebf40568 20 points4 obsCarr::getPoints () {
IceTeam 46:be4eebf40568 21 return {
IceTeam 46:be4eebf40568 22 point (xcentre - (dxtaille + MINDISTROBOT), ycentre + (dytaille + MINDISTROBOT)),
IceTeam 46:be4eebf40568 23 point (xcentre + (dxtaille + MINDISTROBOT), ycentre + (dytaille + MINDISTROBOT)),
IceTeam 46:be4eebf40568 24 point (xcentre - (dxtaille + MINDISTROBOT), ycentre - (dytaille + MINDISTROBOT)),
IceTeam 46:be4eebf40568 25 point (xcentre + (dxtaille + MINDISTROBOT), ycentre - (dytaille + MINDISTROBOT)),
IceTeam 46:be4eebf40568 26 };
IceTeam 46:be4eebf40568 27 }
IceTeam 46:be4eebf40568 28
IceTeam 46:be4eebf40568 29 bool obsCarr::belongs (point& A) {
IceTeam 46:be4eebf40568 30 return (A.getX () <= xcentre + dxtaille && A.getX () >= xcentre - dxtaille && A.getY () <= ycentre + dytaille && A.getY () >= ycentre - dytaille);
IceTeam 46:be4eebf40568 31 }