26 #ifndef WFMATH_CONST_H
27 #define WFMATH_CONST_H
33 #error "You are using an older version of MSVC++ with extremely poor"
34 #error "template support. Please use at least version 2008,"
35 #error "or try a different compiler."
48 template<
int dim>
class AxisBox;
49 template<
int dim>
class Ball;
50 template<
int dim>
class Point;
51 template<
int dim>
class Polygon;
52 template<
int dim>
class RotBox;
53 template<
int dim>
class RotMatrix;
54 template<
int dim>
class Segment;
55 template<
int dim>
class Vector;
61 const double Pi = 3.14159265358979323846264338327950288419716939937508;
63 const double SqrtPi = 1.77245385090551602729816748334114518279754945612237;
65 const double LogPi = 1.14472988584940017414342735135305871164729481291530;
67 const double Sqrt2 = 1.41421356237309504880168872420969807856967187537693;
69 const double Sqrt3 = 1.73205080756887729352744634150587236694280525381037;
71 const double Log2 = 0.69314718055994530941723212145817656807550013436025;
74 #define WFMATH_PRECISION_FUDGE_FACTOR 30
76 #define WFMATH_MAX_NORM_AGE ((WFMATH_PRECISION_FUDGE_FACTOR * 2) / 3)
81 #define WFMATH_EPSILON (WFMATH_PRECISION_FUDGE_FACTOR * FLT_EPSILON)
84 #define WFMATH_MAX FLT_MAX
86 #define WFMATH_MIN FLT_MIN
90 double _ScaleEpsilon(
double x1,
double x2,
double epsilon);
92 int length,
double epsilon = WFMATH_EPSILON);
103 inline bool Equal(
const C& c1,
const C& c2,
double epsilon = WFMATH_EPSILON)
104 {
return c1.isEqualTo(c2, epsilon);}
106 bool Equal(
double x1,
double x2,
double epsilon = WFMATH_EPSILON);
108 bool Equal(
float x1,
float x2,
double epsilon = WFMATH_EPSILON);
114 {
return (a > b) ? a : b;}
116 {
return (a < b) ? a : b;}
118 {
return (min >= val) ? min : (max <= val ? max : val);}
120 inline double DoubleMax(
double a,
double b)
121 {
return (a > b) ? a : b;}
122 inline double DoubleMin(
double a,
double b)
123 {
return (a < b) ? a : b;}
124 inline double DoubleClamp(
double val,
double min,
double max)
125 {
return (min >= val) ? min : (max <= val ? max : val);}
129 #endif // WFMATH_CONST_H