Recast Navigation  1.0.35
Util.h
Go to the documentation of this file.
1 //
2 // Util.h
3 // Recast
4 //
5 // Created by Graham Pentheny on 7/31/15.
6 //
7 //
8 
9 #ifndef Recast_Math_h
10 #define Recast_Math_h
11 
14 
18 template<class T> inline void rcSwap(T& a, T& b) { T t = a; a = b; b = t; }
19 
24 template<class T> inline T rcMin(T a, T b) { return a < b ? a : b; }
25 
30 template<class T> inline T rcMax(T a, T b) { return a > b ? a : b; }
31 
35 template<class T> inline T rcAbs(T a) { return a < 0 ? -a : a; }
36 
40 template<class T> inline T rcSqr(T a) { return a*a; }
41 
47 template<class T> inline T rcClamp(T v, T mn, T mx) { return v < mn ? mn : (v > mx ? mx : v); }
48 
52 float rcSqrt(float x);
53 
54 #endif
T rcMax(T a, T b)
Returns the maximum of two values.
Definition: Util.h:30
T rcAbs(T a)
Returns the absolute value.
Definition: Util.h:35
void rcSwap(T &a, T &b)
Swaps the values of the two parameters.
Definition: Util.h:18
T rcMin(T a, T b)
Returns the minimum of two values.
Definition: Util.h:24
float rcSqrt(float x)
Returns the square root of the value.
Definition: Recast.cpp:30
T rcSqr(T a)
Returns the square of the value.
Definition: Util.h:40
T rcClamp(T v, T mn, T mx)
Clamps the value to the specified range.
Definition: Util.h:47