18 #include <grass/gis.h>
19 #include <grass/bitmap.h>
20 #include <grass/interpf.h>
25 struct BM *bitmask,
double *gmin,
double *gmax,
double *c1min,
double *c1max,
double *c2min,
double *c2max,
37 dx2 = 0, dy2 = 0, grad2 = 0,
47 int i, got, bmask = 1;
48 static int first_time_g = 1;
54 for (i = ngstc; i <= nszc; i++) {
55 if (bitmask !=
NULL) {
56 bmask =
BM_get(bitmask, i, k);
60 while ((got == 0) && (cond1)) {
61 dx2 = (double)(params->
adx[i] * params->
adx[i]);
62 dy2 = (double)(params->
ady[i] * params->
ady[i]);
67 slp = ro * atan(grad);
68 if (grad <= gradmin) {
84 if (params->
adx[i] == 0.) {
85 if (params->
ady[i] > 0.)
91 oor = ro * atan2(params->
ady[i], params->
adx[i]);
98 if ((got != 3) && (cond2)) {
100 dnorm1 = sqrt(grad2 + 1.);
102 2. * (double)(params->
adxy[i] * params->
adx[i] *
107 (double)(params->
adxx[i] * dx2 + dxy2 +
108 params->
adyy[i] * dy2) / (grad2 * dnorm1 *
112 (double)(params->
adxx[i] * dy2 - dxy2 +
113 params->
adyy[i] * dx2) / (grad2 * dnorm1);
117 .5 * ((1. + dy2) * params->
adxx[i] - dxy2 +
118 (1. + dx2) * params->
adyy[i]) / (temp * dnorm1);
123 *c1min = *c1max = curn;
124 *c2min = *c2max = curh;
126 *gmin =
amin1(*gmin, slp);
127 *gmax =
amax1(*gmax, slp);
128 *c1min =
amin1(*c1min, curn);
129 *c1max =
amax1(*c1max, curn);
130 *c2min =
amin1(*c2min, curh);
131 *c2max =
amax1(*c2max, curh);
133 params->
adx[i] = (FCELL) slp;
134 params->
ady[i] = (FCELL) oor;
136 params->
adxx[i] = (FCELL) curn;
137 params->
adyy[i] = (FCELL) curh;
138 params->
adxy[i] = (FCELL) curm;
int BM_get(struct BM *map, int x, int y)
Gets 'val' from the bitmap.
double amax1(double, double)
int IL_secpar_loop_2d(struct interp_params *, int, int, int, struct BM *, double *, double *, double *, double *, double *, double *, int, int)
double amin1(double, double)