23 return u * (c1 - c0) + c0;
37 return (u * (u * (u * (c3 - 3 * c2 + 3 * c1 - c0) +
38 (-c3 + 4 * c2 - 5 * c1 + 2 * c0)) + (c2 - c0)) +
58 double uweight[5], vweight[5], d, d_pi;
60 DCELL c0, c1, c2, c3, c4;
61 double sind, sincd1, sincd2;
65 sincd1 = sind * sin(d_pi / 2);
66 uweight[2] = (u == 0 ? 1 : sincd1 / (d_pi * d_pi));
74 uweight[0] = (d == 0 ? 1 : -sincd1 / (d_pi * d_pi));
79 sincd2 = sind * sin(d_pi / 2);
80 uweight[1] = (d == 0 ? 1 : -sincd2 / (d_pi * d_pi));
85 uweight[3] = (d == 0 ? 1 : sincd2 / (d_pi * d_pi));
93 uweight[4] = (d == 0 ? 1 : -sincd1 / (d_pi * d_pi));
99 sincd1 = sind * sin(d_pi / 2);
100 vweight[2] = (v == 0 ? 1 : sincd1 / (d_pi * d_pi));
108 vweight[0] = (d == 0 ? 1 : -sincd1 / (d_pi * d_pi));
113 sincd2 = sind * sin(d_pi / 2);
114 vweight[1] = (d == 0 ? 1 : -sincd2 / (d_pi * d_pi));
119 vweight[3] = (d == 0 ? 1 : sincd2 / (d_pi * d_pi));
127 vweight[4] = (d == 0 ? 1 : -sincd1 / (d_pi * d_pi));
130 c0 = (c[0] * uweight[0] + c[1] * uweight[1] + c[2] * uweight[2]
131 + c[3] * uweight[3] + c[4] * uweight[4]);
132 c1 = (c[5] * uweight[0] + c[6] * uweight[1] + c[7] * uweight[2]
133 + c[8] * uweight[3] + c[9] * uweight[4]);
134 c2 = (c[10] * uweight[0] + c[11] * uweight[1] + c[12] * uweight[2]
135 + c[13] * uweight[3] + c[14] * uweight[4]);
136 c3 = (c[15] * uweight[0] + c[16] * uweight[1] + c[17] * uweight[2]
137 + c[18] * uweight[3] + c[19] * uweight[4]);
138 c4 = (c[20] * uweight[0] + c[21] * uweight[1] + c[22] * uweight[2]
139 + c[23] * uweight[3] + c[24] * uweight[4]);
141 return ((c0 * vweight[0] + c1 * vweight[1] + c2 * vweight[2] +
142 c3 * vweight[3] + c4 * vweight[4]) / (usum * vsum));
147 return (u * (u * (u * (c3 - 3 * c2 + 3 * c1 - c0) +
148 (3 * c2 - 6 * c1 + 3 * c0)) +
150 c2 + 4 * c1 + c0) / 6;
199 if (strcmp(option->
answer,
"nearest") == 0) {
202 else if (strcmp(option->
answer,
"bilinear") == 0) {
205 else if (strcmp(option->
answer,
"bicubic") == 0) {
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
DCELL Rast_interp_lanczos(double u, double v, DCELL *c)
DCELL Rast_interp_bicubic_bspline(double u, double v, DCELL c00, DCELL c01, DCELL c02, DCELL c03, DCELL c10, DCELL c11, DCELL c12, DCELL c13, DCELL c20, DCELL c21, DCELL c22, DCELL c23, DCELL c30, DCELL c31, DCELL c32, DCELL c33)
DCELL Rast_interp_linear(double u, DCELL c0, DCELL c1)
int Rast_option_to_interp_type(const struct Option *option)
Get interpolation method from the option.
DCELL Rast_interp_cubic_bspline(double u, DCELL c0, DCELL c1, DCELL c2, DCELL c3)
DCELL Rast_interp_bicubic(double u, double v, DCELL c00, DCELL c01, DCELL c02, DCELL c03, DCELL c10, DCELL c11, DCELL c12, DCELL c13, DCELL c20, DCELL c21, DCELL c22, DCELL c23, DCELL c30, DCELL c31, DCELL c32, DCELL c33)
DCELL Rast_interp_bilinear(double u, double v, DCELL c00, DCELL c01, DCELL c10, DCELL c11)
#define INTERP_UNKNOWN
Interpolation methods.
Structure that stores option information.
DCELL Rast_interp_cubic(double u, DCELL c0, DCELL c1, DCELL c2, DCELL c3)