initial version

This commit is contained in:
2016-01-21 11:10:55 +01:00
parent 8818a9b216
commit a7dc0cabbb
21 changed files with 1397 additions and 0 deletions

33
geo/Angle.h Executable file
View File

@@ -0,0 +1,33 @@
#ifndef ANGLE_H
#define ANGLE_H
#include <cmath>
class Angle {
public:
/** get the radians from (x1,y1) to (x2,y2) */
static float getRAD(const float x1, const float y1, const float x2, const float y2) {
const float tmp = std::atan2(y2-y1, x2-x1);
return (tmp < 0) ? (tmp + 2*M_PI) : (tmp);
}
/** get the degrees from (x1,y1) to (x2,y2) */
static float getDEG(const float x1, const float y1, const float x2, const float y2) {
return radToDeg(getRAD(x1,y1,x2,y2));
}
/** convert degrees to radians */
static float degToRad(const float deg) {
return deg / 180 * M_PI;
}
/** convert radians to degrees */
static float radToDeg(const float rad) {
return rad * 180 / M_PI;
}
};
#endif // ANGLE_H