20 #ifndef vtkImageInterpolatorInternals_h
21 #define vtkImageInterpolatorInternals_h
58 static int Floor(
double x, F &f);
61 static int Round(
double x);
64 static int Clamp(
int a,
int b,
int c);
65 static int Wrap(
int a,
int b,
int c);
66 static int Mirror(
int a,
int b,
int c);
82 #if defined ia64 || defined __ia64__ || defined _M_IA64
83 #define VTK_INTERPOLATE_64BIT_FLOOR
84 #elif defined __ppc64__ || defined __x86_64__ || defined _M_X64
85 #define VTK_INTERPOLATE_64BIT_FLOOR
86 #elif defined __ppc__ || defined sparc || defined mips
87 #define VTK_INTERPOLATE_32BIT_FLOOR
88 #elif defined i386 || defined _M_IX86
89 #define VTK_INTERPOLATE_I386_FLOOR
96 #define VTK_INTERPOLATE_FLOOR_TOL 7.62939453125e-06
101 #if defined VTK_INTERPOLATE_64BIT_FLOOR
103 long long i =
static_cast<long long>(x);
104 f =
static_cast<F
>(x - i);
105 return static_cast<int>(i - 103079215104LL);
106 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
108 unsigned int i =
static_cast<unsigned int>(x);
110 return static_cast<int>(i - 2147483648U);
111 #elif defined VTK_INTERPOLATE_I386_FLOOR
112 union {
double d;
unsigned short s[4];
unsigned int i[2]; } dual;
113 dual.d = x + 103079215104.0;
114 f = dual.s[0]*0.0000152587890625;
115 return static_cast<int>((dual.i[1]<<16)|((dual.i[0])>>16));
127 #if defined VTK_INTERPOLATE_64BIT_FLOOR
129 long long i =
static_cast<long long>(x);
130 return static_cast<int>(i - 103079215104LL);
131 #elif defined VTK_INTERPOLATE_32BIT_FLOOR
133 unsigned int i =
static_cast<unsigned int>(x);
134 return static_cast<int>(i - 2147483648U);
135 #elif defined VTK_INTERPOLATE_I386_FLOOR
136 union {
double d;
unsigned int i[2]; } dual;
137 dual.d = x + 103079215104.5;
138 return static_cast<int>((dual.i[1]<<16)|((dual.i[0])>>16));
149 a = (a <= c ? a : c);
151 a = (a >= 0 ? a : 0);
160 int range = c - b + 1;
164 a = (a >= 0 ? a : a +
range);
173 #ifndef VTK_IMAGE_BORDER_LEGACY_MIRROR
175 int ifzero = (range == 0);
176 int range2 = 2*range + ifzero;
178 a = (a >= 0 ? a : -a);
180 a = (a <= range ? a : range2 - a);
183 int range = c - b + 1;
184 int range2 = 2*
range;
186 a = (a >= 0 ? a : -a - 1);
188 a = (a < range ? a : range2 - a - 1);
static int Round(double x)
static int Mirror(int a, int b, int c)
static int Clamp(int a, int b, int c)
static int Wrap(int a, int b, int c)
static int Floor(double x)
Rounds a double to the nearest integer not greater than itself.
static int Floor(double x, F &f)
#define VTK_INTERPOLATE_FLOOR_TOL
vtkInterpolationWeights(const vtkInterpolationInfo &info)