HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SYS_MathPermute.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: SYS_MathPermute.h ( SYS Library, C++)
7  *
8  * COMMENTS: This header file defines all the impure permutations of
9  * fpreal32 and fpreal64 for the SYS_Math.h library functions.
10  * All fpreal32's are cast up to fpreal64 for the computations.
11  */
12 
13 #ifndef __SYS_MathPermute__
14 #define __SYS_MathPermute__
15 
16 #ifndef __SYS_Math__
17  #error "SYS_MathPermute.h should only be included by SYS_Math.h"
18 #endif
19 
20 #define ARGS_2(fname) \
21  static inline fpreal64 fname(fpreal32 a, fpreal64 b) \
22  { return fname((fpreal64)a, b); } \
23  static inline fpreal64 fname(fpreal64 a, fpreal32 b) \
24  { return fname(a, (fpreal64)b); } \
25 
26 #define ARGS_3(fname) \
27  static inline fpreal64 fname(fpreal32 a, fpreal64 b, fpreal64 c) \
28  { return fname((fpreal64)a, b, c); } \
29  static inline fpreal64 fname(fpreal64 a, fpreal32 b, fpreal64 c) \
30  { return fname(a, (fpreal64)b, c); } \
31  static inline fpreal64 fname(fpreal32 a, fpreal32 b, fpreal64 c) \
32  { return fname((fpreal64)a, (fpreal64)b, c); } \
33  static inline fpreal64 fname(fpreal64 a, fpreal64 b, fpreal32 c) \
34  { return fname(a, b, (fpreal64)c); } \
35  static inline fpreal64 fname(fpreal32 a, fpreal64 b, fpreal32 c) \
36  { return fname((fpreal64)a, b, (fpreal64)c); } \
37  static inline fpreal64 fname(fpreal64 a, fpreal32 b, fpreal32 c) \
38  { return fname(a, (fpreal64)b, (fpreal64)c); }
39 
40 #define ARGS_4(fname) \
41  static inline fpreal64 fname(fpreal64 a,fpreal32 b,fpreal32 c,fpreal32 d) \
42  { return fname(a, (fpreal64)b, (fpreal64)c, (fpreal64)d); } \
43  static inline fpreal64 fname(fpreal32 a,fpreal64 b,fpreal32 c,fpreal32 d) \
44  { return fname((fpreal64)a, b, (fpreal64)c, (fpreal64)d); } \
45  static inline fpreal64 fname(fpreal64 a,fpreal64 b,fpreal32 c,fpreal32 d) \
46  { return fname(a, b, (fpreal64)c, (fpreal64)d); } \
47  static inline fpreal64 fname(fpreal32 a,fpreal32 b,fpreal64 c,fpreal32 d) \
48  { return fname((fpreal64)a, (fpreal64)b, c, (fpreal64)d); } \
49  static inline fpreal64 fname(fpreal64 a,fpreal32 b,fpreal64 c,fpreal32 d) \
50  { return fname(a, (fpreal64)b, c, (fpreal64)d); } \
51  static inline fpreal64 fname(fpreal32 a,fpreal64 b,fpreal64 c,fpreal32 d) \
52  { return fname((fpreal64)a, b, c, (fpreal64)d); } \
53  static inline fpreal64 fname(fpreal64 a,fpreal64 b,fpreal64 c,fpreal32 d) \
54  { return fname(a, b, c, (fpreal64)d); } \
55  static inline fpreal64 fname(fpreal32 a,fpreal32 b,fpreal32 c,fpreal64 d) \
56  { return fname((fpreal64)a, (fpreal64)b, (fpreal64)c, d); } \
57  static inline fpreal64 fname(fpreal64 a,fpreal32 b,fpreal32 c,fpreal64 d) \
58  { return fname(a, (fpreal64)b, (fpreal64)c, d); } \
59  static inline fpreal64 fname(fpreal32 a,fpreal64 b,fpreal32 c,fpreal64 d) \
60  { return fname((fpreal64)a, b, (fpreal64)c, d); } \
61  static inline fpreal64 fname(fpreal64 a,fpreal64 b,fpreal32 c,fpreal64 d) \
62  { return fname(a, b, (fpreal64)c, d); } \
63  static inline fpreal64 fname(fpreal32 a,fpreal32 b,fpreal64 c,fpreal64 d) \
64  { return fname((fpreal64)a, (fpreal64)b, c, d); } \
65  static inline fpreal64 fname(fpreal64 a,fpreal32 b,fpreal64 c,fpreal64 d) \
66  { return fname(a, (fpreal64)b, c, d); } \
67  static inline fpreal64 fname(fpreal32 a,fpreal64 b,fpreal64 c,fpreal64 d) \
68  { return fname((fpreal64)a, b, c, d); }
69 
76 ARGS_3(SYSavg)
77 ARGS_4(SYSavg)
78 
79 ARGS_3(SYSclamp)
81 ARGS_3(SYSsmooth)
82 ARGS_4(SYSsmooth)
83 
84 // TODO: SYSminmax
85 // TODO: SYSfit
86 
87 ARGS_2(SYSatan)
88 ARGS_2(SYSatan2)
89 ARGS_2(SYShypot)
90 
92 
93 static inline bool
94 SYSequalZero(fpreal32 v, fpreal64 tol)
95  { return SYSequalZero(v, (fpreal32)tol); }
96 
97 static inline bool
98 SYSequalZero(fpreal64 v, fpreal32 tol)
99  { return SYSequalZero(v, (fpreal64)tol); }
100 
101 #define CMP_PERM(fname) \
102  static inline bool fname(fpreal32 a, fpreal32 b, fpreal64 tol) \
103  { return fname(a, b, (fpreal32)tol); } \
104  static inline bool fname(fpreal64 a, fpreal64 b, fpreal32 tol) \
105  { return fname(a, b, (fpreal64)tol); } \
106  static inline bool fname(fpreal32 a, fpreal64 b, fpreal32 tol) \
107  { return fname((fpreal64)a, b, (fpreal64)tol); } \
108  static inline bool fname(fpreal64 a, fpreal32 b, fpreal32 tol) \
109  { return fname(a, (fpreal64)b, (fpreal64)tol); } \
110  static inline bool fname(fpreal32 a, fpreal64 b, fpreal64 tol=SYS_FTOLERANCE_D) \
111  { return fname((fpreal64)a, b, tol); } \
112  static inline bool fname(fpreal64 a, fpreal32 b, fpreal64 tol=SYS_FTOLERANCE_D) \
113  { return fname(a, (fpreal64)b, tol); } \
114  static inline bool fname(fpreal32 a, int b, fpreal32 tol=SYS_FTOLERANCE) \
115  { return fname(a, (fpreal32)b, tol); } \
116  static inline bool fname(fpreal32 a, int b, fpreal64 tol) \
117  { return fname((fpreal64)a, (fpreal64)b, tol); } \
118  static inline bool fname(fpreal64 a, int b, fpreal64 tol=SYS_FTOLERANCE_D) \
119  { return fname(a, (fpreal64)b, tol); } \
120  static inline bool fname(int a, fpreal32 b, fpreal32 tol=SYS_FTOLERANCE) \
121  { return fname((fpreal32)a, b, tol); } \
122  static inline bool fname(int a, fpreal32 b, fpreal64 tol) \
123  { return fname((fpreal64)a, (fpreal64)b, tol); } \
124  static inline bool fname(int a, fpreal64 b, fpreal64 tol=SYS_FTOLERANCE_D) \
125  { return fname((fpreal64)a, b, tol); }
126 
127 CMP_PERM(SYSisEqual)
128 CMP_PERM(SYSisGreater)
129 CMP_PERM(SYSisGreaterOrEqual)
130 CMP_PERM(SYSisLess)
131 CMP_PERM(SYSisLessOrEqual)
132 
133 #undef CMP_PERM
134 #undef ARGS_2
135 #undef ARGS_3
136 #undef ARGS_4
137 
138 #endif
#define SYSmax(a, b)
Definition: SYS_Math.h:1365
#define ARGS_3(fname)
const GLdouble * v
Definition: glcorearb.h:836
UT_Matrix2T< T > SYSlerp(const UT_Matrix2T< T > &v1, const UT_Matrix2T< T > &v2, S t)
Definition: UT_Matrix2.h:595
#define ARGS_2(fname)
double fpreal64
Definition: SYS_Types.h:185
SYS_API fpreal32 SYSroundAngle(fpreal32 base, fpreal32 source)
#define CMP_PERM(fname)
#define ARGS_4(fname)
#define SYSmin(a, b)
Definition: SYS_Math.h:1366
float fpreal32
Definition: SYS_Types.h:184