26 #include <grass/dataquad.h>
82 for (i = 0; i <= kmax; i++) {
97 int cond1, cond2, cond3, cond4, rows, cols;
98 double ew_res, ns_res;
106 if (data->
n_rows % 2 == 0) {
110 rows = (int)(data->
n_rows / 2) + 1;
113 if (data->
n_cols % 2 == 0) {
117 cols = (int)(data->
n_cols / 2) + 1;
119 cond1 = (point->
x >= data->
x_orig);
120 cond2 = (point->
x >= data->
x_orig + ew_res * cols);
121 cond3 = (point->
y >= data->
y_orig);
122 cond4 = (point->
y >= data->
y_orig + ns_res * rows);
123 if (cond1 && cond3) {
145 fprintf(stderr,
"add_data: data is NULL \n");
148 for (
int i = 0; i < data->
n_points; i++) {
149 double xx = data->
points[i].
x - point->
x;
150 double yy = data->
points[i].
y - point->
y;
151 double r = xx * xx + yy * yy;
178 double xmin, xmax, ymin, ymax;
180 xmin = data_inter->
x_orig;
181 xmax = data_inter->
xmax;
182 ymin = data_inter->
y_orig;
183 ymax = data_inter->
ymax;
185 if (((data->
x_orig >= xmin) && (data->
x_orig <= xmax) &&
187 ((ymin >= data->
y_orig) && (ymin <= data->ymax)))) ||
188 ((xmin >= data->
x_orig) && (xmin <= data->xmax) &&
189 (((ymin >= data->
y_orig) && (ymin <= data->ymax)) ||
229 int cols1, cols2, rows1, rows2, i;
231 double xr, xm, xl, yr, ym, yl;
232 double ew_res, ns_res;
239 "Points are too concentrated -- please increase DMIN\n");
243 if (data->
n_cols % 2 == 0) {
248 cols2 = (int)(data->
n_cols / 2);
251 if (data->
n_rows % 2 == 0) {
256 rows2 = (int)(data->
n_rows / 2);
277 for (i = 0; i < data->
n_points; i++) {
313 xmin = data_inter->
x_orig;
314 xmax = data_inter->
xmax;
315 ymin = data_inter->
y_orig;
316 ymax = data_inter->
ymax;
317 for (i = 0; i < data->
n_points; i++) {
321 if ((point->
x > xmin) && (point->
x < xmax) && (point->
y > ymin) &&
324 data_inter->
points[ind].
x = point->
x;
325 data_inter->
points[ind].
y = point->
y;
326 data_inter->
points[ind].
z = point->
z;
int quad_add_data(struct triple *point, struct quaddata *data, double dmin)
int quad_division_check(struct quaddata *data, int kmax)
int quad_get_points(struct quaddata *data_inter, struct quaddata *data, int MAX)
int quad_intersect(struct quaddata *data_inter, struct quaddata *data)
struct triple * quad_point_new(double x, double y, double z, double sm)
int quad_compare(struct triple *point, struct quaddata *data)
struct quaddata ** quad_divide_data(struct quaddata *data, int kmax, double dmin)
struct quaddata * quad_data_new(double x_or, double y_or, double xmax, double ymax, int rows, int cols, int n_points, int kmax)