summaryrefslogtreecommitdiff
path: root/2005/i/robert/src/ovision/see/space.cc
diff options
context:
space:
mode:
Diffstat (limited to '2005/i/robert/src/ovision/see/space.cc')
-rw-r--r--2005/i/robert/src/ovision/see/space.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/2005/i/robert/src/ovision/see/space.cc b/2005/i/robert/src/ovision/see/space.cc
index c58268d..efba67b 100644
--- a/2005/i/robert/src/ovision/see/space.cc
+++ b/2005/i/robert/src/ovision/see/space.cc
@@ -161,3 +161,29 @@ Space::getPos (const double locX, const double locY, const double posRobotX, con
posY = posRobotY + locX*sinus + locY*cosinus;
}
+/// Give Real Location dist and angle
+void
+Space::getRealLoc (Zone &zone, int &x, int &y, int &angle, int &dist)
+{
+ // we want a pcY positive to sub it to centery
+ double newPcX, newPcY;
+ if (zone.pcY < 0)
+ {
+ newPcY = - zone.pcY;
+ newPcX = - zone.pcX;
+ }
+ else
+ {
+ newPcX = zone.pcX;
+ newPcY = zone.pcY;
+ }
+ // we are looking for the bottom of the object
+ int tmpX = (int)((zone.xmax - zone.centerx) * newPcX + zone.centerx);
+ int tmpY = (int)((zone.ymax - zone.centery) * newPcY + zone.centery);
+ std::cout << "<Space::getRealLoc> : "<< tmpX << " " << tmpY << "\n";
+ int newX, newY;
+ getLoc (tmpX, tmpY, newX, newY);
+ angle = (int)(atan ((double)newX / ((double)newY + 90)));
+ x = newX; y = newY;
+ dist = (int)sqrt (y*y + x*x);
+}