|
|
@@ -1,7 +1,5 @@ |
|
|
|
#include "utils.h" |
|
|
|
|
|
|
|
#define PI 3.14159265359 |
|
|
|
|
|
|
|
LFRPoint::LFRPoint(/* args */) : x(0.0), y(0.0) |
|
|
|
{ |
|
|
|
} |
|
|
@@ -33,7 +31,7 @@ LFRVector::~LFRVector() |
|
|
|
|
|
|
|
double LFRVector::angle(const LFRVector& other) const |
|
|
|
{ |
|
|
|
return acos(dot(other)/(this->norm()*other.norm())); |
|
|
|
return acos(dot(other)/(this->norm()*other.norm())) * (180.0/M_PI); |
|
|
|
} |
|
|
|
|
|
|
|
double LFRVector::dot(const LFRVector& other) const |
|
|
@@ -71,7 +69,7 @@ int Calcs::calcAngle(int deltaX, int deltaY){ |
|
|
|
int refAngle = 0; |
|
|
|
|
|
|
|
if(deltaX > 10E-12){ |
|
|
|
refAngle = (int)((atan(deltaY/deltaX) * 180.0/PI) + 0.5 - (refAngle<0)); //Here 0.5 (or -0.5) is added to round a float number to int right |
|
|
|
refAngle = (int)((atan(deltaY/deltaX) * 180.0/M_PI) + 0.5 - (refAngle<0)); //Here 0.5 (or -0.5) is added to round a float number to int right |
|
|
|
|
|
|
|
// convert from img coordinates to regbot coordinates |
|
|
|
refAngle = -(refAngle); |