6void 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,
31 values[i], thresh, threshx, tval - values[i]);
35 if (Rast_is_d_null_value(&threshx))
36 Rast_set_d_null_value(result, 1);