20 #ifndef vtkImageInterpolatorInternals_h
21 #define vtkImageInterpolatorInternals_h
61 static int Floor(
double x, F &f);
64 static int Round(
double x);
67 static int Clamp(
int a,
int b,
int c);
68 static int Wrap(
int a,
int b,
int c);
69 static int Mirror(
int a,
int b,
int c);
85 #if defined ia64 || defined __ia64__ || defined _M_IA64
86 #define VTK_INTERPOLATE_64BIT_FLOOR
87 #elif defined __ppc64__ || defined __x86_64__ || defined _M_X64
88 #define VTK_INTERPOLATE_64BIT_FLOOR
89 #elif defined __ppc__ || defined sparc || defined mips
90 #define VTK_INTERPOLATE_32BIT_FLOOR
91 #elif defined i386 || defined _M_IX86
92 #define VTK_INTERPOLATE_I386_FLOOR
99 #define VTK_INTERPOLATE_FLOOR_TOL 7.62939453125e-06
104 #if defined VTK_INTERPOLATE_64BIT_FLOOR
106 long long i = static_cast<long long>(x);
107 f = static_cast<F>(x - i);
108 return static_cast<int>(i - 103079215104LL);
109 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
111 unsigned int i = static_cast<unsigned int>(x);
113 return static_cast<int>(i - 2147483648U);
114 #elif defined VTK_INTERPOLATE_I386_FLOOR
115 union {
double d;
unsigned short s[4];
unsigned int i[2]; } dual;
116 dual.d = x + 103079215104.0;
117 f = dual.s[0]*0.0000152587890625;
118 return static_cast<int>((dual.i[1]<<16)|((dual.i[0])>>16));
130 #if defined VTK_INTERPOLATE_64BIT_FLOOR
132 long long i = static_cast<long long>(x);
133 return static_cast<int>(i - 103079215104LL);
134 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
136 unsigned int i = static_cast<unsigned int>(x);
137 return static_cast<int>(i - 2147483648U);
138 #elif defined VTK_INTERPOLATE_I386_FLOOR
139 union {
double d;
unsigned int i[2]; } dual;
140 dual.d = x + 103079215104.5;
141 return static_cast<int>((dual.i[1]<<16)|((dual.i[0])>>16));
152 a = (a <= c ? a : c);
154 a = (a >= 0 ? a : 0);
163 int range = c - b + 1;
167 a = (a >= 0 ? a : a +
range);
176 #ifndef VTK_IMAGE_BORDER_LEGACY_MIRROR
178 int ifzero = (
range == 0);
179 int range2 = 2*
range + ifzero;
181 a = (a >= 0 ? a : -a);
183 a = (a <=
range ? a : range2 - a);
186 int range = c - b + 1;
187 int range2 = 2*
range;
189 a = (a >= 0 ? a : -a - 1);
191 a = (a <
range ? a : range2 - a - 1);