4 #include <grass/raster.h>
6 void c_thresh(DCELL * result, DCELL * values,
int n,
const void *closure)
9 double tval = *(
const double *)closure;
10 double epsilon = GRASS_EPSILON;
13 Rast_set_d_null_value(&thresh, 1);
14 Rast_set_d_null_value(&threshx, 1);
16 for (i = 0; i < n; i++) {
18 if (! Rast_is_d_null_value(&threshx))
21 if (Rast_is_d_null_value(&values[i]))
24 G_debug(2,
"values[%d] %f, tval %f", i, values[i], tval);
27 if (fabs(tval - values[i]) < epsilon ) {
30 G_debug(2,
"values[%d] %f, thresh %f, threshx %f, diff %f", i, values[i], thresh, threshx, tval - values[i]);
34 if (Rast_is_d_null_value(&threshx))
35 Rast_set_d_null_value(result, 1);
int G_debug(int level, const char *msg,...)
Print debugging message.
void c_thresh(DCELL *result, DCELL *values, int n, const void *closure)