| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
#include <math.h> |
| 13 |
#include "global.h" |
| 14 |
|
| 15 |
void p_cubic_f(struct cache *ibuffer, |
| 16 |
void *obufptr, |
| 17 |
int cell_type, |
| 18 |
double *row_idx, |
| 19 |
double *col_idx, |
| 20 |
struct Cell_head *cellhd |
| 21 |
) |
| 22 |
{ |
| 23 |
|
| 24 |
int row, col; |
| 25 |
DCELL *cellp, cell; |
| 26 |
|
| 27 |
|
| 28 |
row = (int)floor(*row_idx); |
| 29 |
col = (int)floor(*col_idx); |
| 30 |
|
| 31 |
|
| 32 |
if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) { |
| 33 |
Rast_set_null_value(obufptr, 1, cell_type); |
| 34 |
return; |
| 35 |
} |
| 36 |
|
| 37 |
cellp = CPTR(ibuffer, row, col); |
| 38 |
|
| 39 |
if (Rast_is_d_null_value(cellp)) { |
| 40 |
Rast_set_null_value(obufptr, 1, cell_type); |
| 41 |
return; |
| 42 |
} |
| 43 |
cell = *cellp; |
| 44 |
|
| 45 |
p_cubic(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd); |
| 46 |
|
| 47 |
if (Rast_is_d_null_value(obufptr)) { |
| 48 |
p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd); |
| 49 |
|
| 50 |
if (Rast_is_d_null_value(obufptr)) |
| 51 |
Rast_set_d_value(obufptr, cell, cell_type); |
| 52 |
} |
| 53 |
} |