Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #ifndef __CXUTILS_MATH_UTILITIES_H
00041 #define __CXUTILS_MATH_UTILITIES_H
00042
00043 #include <math.h>
00044
00045 #include "vector3d.h"
00046 #include "point3d.h"
00047 #include "segment3d.h"
00048 #include "matrix.h"
00049 #include "quaternion.h"
00050 #include "coordinates.h"
00051
00052 #define CX_DEG2RAD(deg) ((deg)*CxUtils::CX_PI_OVER_180) ///< Convert degrees to radians.
00053 #define CX_RAD2DEG(rad) ((rad)*CxUtils::CX_180_OVER_PI) ///< Convert radians to degrees.
00054 #define CX_ISNAN(x) ((x) != (x)) ///< Checks if the value is a number.
00055 #define CX_FLOAT_EQUAL(left, right, thresh)( fabs( left - right ) < thresh ) ///< Compare floating point numbers.
00056
00057
00058 namespace CxUtils
00059 {
00060 const double CX_PI = 3.14159265358979323846;
00061 const double CX_HALF_PI = 1.57079632679489661923;
00062 const double CX_FOURTH_PI = 0.785398163397448309615;
00063 const double CX_PI_OVER_180 = 0.0174532925199432957692222;
00064 const double CX_180_OVER_PI = 57.295779513082320876846364;
00065 const double CX_TWO_PI = 6.28318530717958647692;
00066 const double CX_EPSILON = .00000000000000000000001;
00067
00068 const double PI = 3.14159265358979323846;
00069 const double Epsilon = .00000000000000000000001;
00070
00080 inline double CxToRadians(const double deg)
00081 {
00082 return deg*CX_PI_OVER_180;
00083 }
00093 inline double CxToDegrees(const double rad)
00094 {
00095 return rad*CX_180_OVER_PI;
00096 }
00097 }
00098
00099
00100
00101 #endif
00102