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