26 #include <grass/interpf.h>
38 struct BM *bitmask,
double *gmin,
double *gmax,
double *c1min,
39 double *c1max,
double *c2min,
double *c2max,
45 dx2 = 0, dy2 = 0, grad2 = 0,
55 int i, got, bmask = 1;
56 static int first_time_g = 1;
61 for (i = ngstc; i <= nszc; i++) {
62 if (bitmask !=
NULL) {
63 bmask =
BM_get(bitmask, i, k);
67 while ((got == 0) && (cond1)) {
68 dx2 = (double)(params->
adx[i] * params->
adx[i]);
69 dy2 = (double)(params->
ady[i] * params->
ady[i]);
74 slp = ro * atan(grad);
75 if (grad <= gradmin) {
92 if (params->
adx[i] == 0.) {
93 if (params->
ady[i] > 0.)
99 oor = ro * atan2(params->
ady[i], params->
adx[i]);
106 if ((got != 3) && (cond2)) {
108 dnorm1 = sqrt(grad2 + 1.);
109 dxy2 = 2. * (double)(params->
adxy[i] * params->
adx[i] *
112 curn = (double)(params->
adxx[i] * dx2 + dxy2 +
113 params->
adyy[i] * dy2) /
114 (grad2 * dnorm1 * dnorm1 * dnorm1);
116 curh = (double)(params->
adxx[i] * dy2 - dxy2 +
117 params->
adyy[i] * dx2) /
122 ((1. + dy2) * params->
adxx[i] - dxy2 +
123 (1. + dx2) * params->
adyy[i]) /
129 *c1min = *c1max = curn;
130 *c2min = *c2max = curh;
132 *gmin =
amin1(*gmin, slp);
133 *gmax =
amax1(*gmax, slp);
134 *c1min =
amin1(*c1min, curn);
135 *c1max =
amax1(*c1max, curn);
136 *c2min =
amin1(*c2min, curh);
137 *c2max =
amax1(*c2max, curh);
int BM_get(struct BM *, int, int)
Gets 'val' from the bitmap.
double amin1(double, double)
double amax1(double, double)
int IL_secpar_loop_2d(struct interp_params *params, int ngstc, int nszc, int k, struct BM *bitmask, double *gmin, double *gmax, double *c1min, double *c1max, double *c2min, double *c2max, int cond1, int cond2)