20 #ifndef vtkImageInterpolatorInternals_h
21 #define vtkImageInterpolatorInternals_h
64 static int Floor(
double x, F& f);
67 static int Round(
double x);
70 static int Clamp(
int a,
int b,
int c);
71 static int Wrap(
int a,
int b,
int c);
72 static int Mirror(
int a,
int b,
int c);
88 #if defined ia64 || defined __ia64__ || defined _M_IA64
89 #define VTK_INTERPOLATE_64BIT_FLOOR
90 #elif defined __ppc64__ || defined __x86_64__ || defined _M_X64
91 #define VTK_INTERPOLATE_64BIT_FLOOR
92 #elif defined __ppc__ || defined sparc || defined mips
93 #define VTK_INTERPOLATE_32BIT_FLOOR
94 #elif defined i386 || defined _M_IX86
95 #define VTK_INTERPOLATE_I386_FLOOR
102 #define VTK_INTERPOLATE_FLOOR_TOL 7.62939453125e-06
107 #if defined VTK_INTERPOLATE_64BIT_FLOOR
109 long long i =
static_cast<long long>(x);
110 f =
static_cast<F
>(x - i);
111 return static_cast<int>(i - 103079215104LL);
112 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
114 unsigned int i =
static_cast<unsigned int>(x);
116 return static_cast<int>(i - 2147483648U);
117 #elif defined VTK_INTERPOLATE_I386_FLOOR
123 dual.d = x + 103079215104.0;
124 f = dual.s[0] * 0.0000152587890625;
125 return static_cast<int>((dual.i[1] << 16) | ((dual.i[0]) >> 16));
136 #if defined VTK_INTERPOLATE_64BIT_FLOOR
138 long long i =
static_cast<long long>(x);
139 return static_cast<int>(i - 103079215104LL);
140 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
142 unsigned int i =
static_cast<unsigned int>(x);
143 return static_cast<int>(i - 2147483648U);
144 #elif defined VTK_INTERPOLATE_I386_FLOOR
149 dual.d = x + 103079215104.5;
150 return static_cast<int>((dual.i[1] << 16) | ((dual.i[0]) >> 16));
161 a = (a <= c ? a : c);
163 a = (a >= 0 ? a : 0);
172 int range = c - b + 1;
176 a = (a >= 0 ? a : a +
range);
185 #ifndef VTK_IMAGE_BORDER_LEGACY_MIRROR
187 int ifzero = (
range == 0);
188 int range2 = 2 *
range + ifzero;
190 a = (a >= 0 ? a : -a);
192 a = (a <=
range ? a : range2 - a);
195 int range = c - b + 1;
196 int range2 = 2 *
range;
198 a = (a >= 0 ? a : -a - 1);
200 a = (a <
range ? a : range2 - a - 1);