]> Shamusworld >> Repos - architektonas/blob - src/base/mathextra.h
Removed unnecessary RS_ prefix from classes and whatnot.
[architektonas] / src / base / mathextra.h
1 #ifndef __MATHEXTRA_H__
2 #define __MATHEXTRA_H__
3
4 #include <QtCore>
5
6 #define ARAD                            57.29577951308232
7 #define RS_TOLERANCE            1.0e-10
8 #define RS_TOLERANCE_ANGLE      1.0e-8
9
10 /**
11  * Math functions.
12  */
13 class Math
14 {
15         public:
16                 static int round(double v);
17                 static double pow(double x, double y);
18                 static double rad2deg(double a);
19                 static double deg2rad(double a);
20                 static double rad2gra(double a);
21                 static int findGCD(int a, int b);
22                 static bool isAngleBetween(double a, double a1, double a2, bool reversed);
23                 static double correctAngle(double a);
24                 static double getAngleDifference(double a1, double a2);
25                 static double makeAngleReadable(double angle, bool readable = true, bool * corrected = NULL);
26                 static bool isAngleReadable(double angle);
27                 static bool isSameDirection(double dir1, double dir2, double tol);
28                 static double eval(const QString & expr, double def = 0.0);
29                 static bool cmpDouble(double v1, double v2, double tol = 0.001);
30                 static double eval(const QString & expr, bool * ok);
31                 static QString doubleToString(double value, double prec);
32                 static QString doubleToString(double value, int prec);
33
34                 static void test();
35 };
36
37 #endif  // __MATHEXTRA_H__