00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
#ifndef OPENCAL_UTILS_MATH_H
00012
#define OPENCAL_UTILS_MATH_H
00013
00014
00015
00016
00017
namespace OpenCAL
00018 {
00019
namespace Utils
00020 {
00025 class OPENCAL_API Math
00026 {
00027
public:
00028
00029
static const float pi = 3.1415926535898f;
00030
static const float halfPi = 1.5707963267949f;
00031
static const float doublePi = 6.2831853071796f;
00032
00033
static const float verySmall = 0.0000001f;
00034
00035
00036
static float radToDeg(
float radians) {
return radians * 57.2957795f; }
00037
static float degToRad(
float degrees) {
return degrees * 0.0174532925f; }
00038
00039
static bool isZero(
float number) {
return (number == 0.0f); }
00040
static bool isZero(
float number,
float tolerance) {
return (number >= -tolerance && number <= tolerance); }
00041
static bool isBetween(
float number,
float min,
float max) {
return (number >= min && number <= max); }
00042
00043
static float squared(
float number) {
return number * number; }
00044 };
00045 }
00046 }
00047
00048
#endif // OPENCAL_UTILS_MATH_H