Isle
Loading...
Searching...
No Matches
legoutil.h
Go to the documentation of this file.
1#ifndef __LEGOUTIL_H
2#define __LEGOUTIL_H
3
4// Exclude from modern compilers due to clash with mxutilities.h
5#ifndef COMPAT_MODE
6
13template <class T>
14inline T Min(T p_t1, T p_t2)
15{
16 return p_t1 < p_t2 ? p_t1 : p_t2;
17}
18
26template <class T>
27inline T Min(T p_t1, T p_t2, T p_t3)
28{
29 return Min(p_t1, Min(p_t2, p_t3));
30}
31
38template <class T>
39inline T Max(T p_t1, T p_t2)
40{
41 return p_t1 > p_t2 ? p_t1 : p_t2;
42}
43
51template <class T>
52inline T Max(T p_t1, T p_t2, T p_t3)
53{
54 return Max(p_t1, Max(p_t2, p_t3));
55}
56
63template <class T>
64inline T Abs(T p_t)
65{
66 return p_t < 0 ? -p_t : p_t;
67}
68
69#endif
70
76template <class T>
77inline void Swap(T& p_t1, T& p_t2)
78{
79 T t = p_t1;
80 p_t1 = p_t2;
81 p_t2 = t;
82}
83
84// TEMPLATE: BETA10 0x10073c20
85// Swap
86
93template <class T>
94inline T DToR(T p_d)
95{
96 return p_d * 3.1416F / 180.0F;
97}
98
105template <class T>
106inline T RToD(T p_r)
107{
108 return p_r * 180.0F / 3.1416F;
109}
110
111#endif // __LEGOUTIL_H
T RToD(T p_r)
[AI] Converts radians to degrees.
Definition: legoutil.h:106
T Max(T p_t1, T p_t2)
[AI] Returns the maximum of two values.
Definition: legoutil.h:39
T DToR(T p_d)
[AI] Converts degrees to radians.
Definition: legoutil.h:94
void Swap(T &p_t1, T &p_t2)
[AI] Swaps the values of two variables of the same type.
Definition: legoutil.h:77
T Min(T p_t1, T p_t2)
[AI] Returns the minimum of two values.
Definition: legoutil.h:14
T Abs(T p_t)
[AI] Returns the absolute value.
Definition: legoutil.h:64