27 #include <grass/dataquad.h> 86 for (i = 0; i <= kmax; i++) {
102 int cond1, cond2, cond3, cond4, rows, cols;
103 double ew_res, ns_res;
111 if (data->
n_rows % 2 == 0) {
115 rows = (int)(data->
n_rows / 2) + 1;
118 if (data->
n_cols % 2 == 0) {
122 cols = (int)(data->
n_cols / 2) + 1;
124 cond1 = (point->
x >= data->
x_orig);
125 cond2 = (point->
x >= data->
x_orig + ew_res * cols);
126 cond3 = (point->
y >= data->
y_orig);
127 cond4 = (point->
y >= data->
y_orig + ns_res * rows);
128 if (cond1 && cond3) {
150 fprintf(stderr,
"add_data: data is NULL \n");
153 for (
int i = 0; i < data->
n_points; i++) {
154 double xx = data->
points[i].
x - point->
x;
155 double yy = data->
points[i].
y - point->
y;
156 double r = xx * xx + yy * yy;
182 double xmin, xmax, ymin, ymax;
184 xmin = data_inter->
x_orig;
185 xmax = data_inter->
xmax;
186 ymin = data_inter->
y_orig;
187 ymax = data_inter->
ymax;
191 || ((ymin >= data->
y_orig) && (ymin <= data->ymax))
194 || ((xmin >= data->
x_orig) && (xmin <= data->xmax)
195 && (((ymin >= data->
y_orig) && (ymin <= data->ymax))
241 int cols1, cols2, rows1, rows2, i;
243 double xr, xm, xl, yr, ym, yl;
244 double ew_res, ns_res;
251 "Points are too concentrated -- please increase DMIN\n");
255 if (data->
n_cols % 2 == 0) {
260 cols2 = (int)(data->
n_cols / 2);
263 if (data->
n_rows % 2 == 0) {
268 rows2 = (int)(data->
n_rows / 2);
289 for (i = 0; i < data->
n_points; i++) {
331 xmin = data_inter->
x_orig;
332 xmax = data_inter->
xmax;
333 ymin = data_inter->
y_orig;
334 ymax = data_inter->
ymax;
335 for (i = 0; i < data->
n_points; i++) {
339 if ((point->
x > xmin) && (point->
x < xmax)
340 && (point->
y > ymin) && (point->
y < ymax)) {
342 data_inter->
points[ind].
x = point->
x;
343 data_inter->
points[ind].
y = point->
y;
344 data_inter->
points[ind].
z = point->
z;
int quad_intersect(struct quaddata *data_inter, struct quaddata *data)
struct triple * quad_point_new(double x, double y, double z, double sm)
struct quaddata * quad_data_new(double x_or, double y_or, double xmax, double ymax, int rows, int cols, int n_points, int kmax)
int quad_compare(struct triple *point, struct quaddata *data)
int quad_get_points(struct quaddata *data_inter, struct quaddata *data, int MAX)
struct quaddata ** quad_divide_data(struct quaddata *data, int kmax, double dmin)
int quad_division_check(struct quaddata *data, int kmax)
int quad_add_data(struct triple *point, struct quaddata *data, double dmin)