29 #include <grass/gis.h>
30 #include <grass/vector.h>
31 #include <grass/dbmi.h>
34 #include <grass/interpf.h>
57 double dnorm,
struct triple *skip_point)
61 struct triple point_writeout;
62 double east = data->
xmax;
63 double west = data->
x_orig;
64 double north = data->
ymax;
65 double south = data->
y_orig;
66 double h, xx, yy, r2, hz, zz,
err, xmm, ymm,
r;
79 for (mm = 1; mm <= n_points; mm++) {
81 for (m = 1; m <= n_points; m++) {
82 xx = points[mm - 1].
x - points[m - 1].
x;
83 yy = points[mm - 1].
y - points[m - 1].
y;
84 r2 = yy * yy + xx * xx;
97 zz = points[mm - 1].
z + zmin;
99 xmm = points[mm - 1].
x * dnorm + params->
x_orig + west;
100 ymm = points[mm - 1].
y * dnorm + params->
y_orig + south;
101 if ((xmm >= west + params->
x_orig) && (xmm <= east + params->x_orig) &&
102 (ymm >= south + params->
y_orig) && (ymm <= north + params->y_orig))
110 point_writeout.
x = xmm;
111 point_writeout.
y = ymm;
112 point_writeout.
z = zz;
122 for (m = 1; m <= n_points - 1; m++) {
123 xx = points[m - 1].
x - skip_point->
x;
124 yy = points[m - 1].
y - skip_point->
y;
125 r2 = yy * yy + xx * xx;
133 zz = skip_point->
z + zmin;
135 xmm = skip_point->
x * dnorm + params->
x_orig + west;
136 ymm = skip_point->
y * dnorm + params->
y_orig + south;
138 if ((xmm >= west + params->
x_orig) && (xmm <= east + params->x_orig) &&
139 (ymm >= south + params->
y_orig) && (ymm <= north + params->y_orig))
145 point_writeout.
x = xmm;
146 point_writeout.
y = ymm;
147 point_writeout.
z = zz;
168 Vect_reset_line(
Pnts);
169 Vect_reset_cats(
Cats2);
171 Vect_append_point(
Pnts, point.
x, point.
y, point.
z);
175 db_zero_string(&
sql2);
176 snprintf(buf,
sizeof(buf),
"insert into %s values ( %d ",
ff->table,
count);
177 db_append_string(&
sql2, buf);
179 snprintf(buf,
sizeof(buf),
", %f",
err);
180 db_append_string(&
sql2, buf);
181 db_append_string(&
sql2,
")");
182 G_debug(3,
"IL_check_at_points_2d: %s", db_get_string(&
sql2));
184 if (db_execute_immediate(
driver2, &
sql2) != DB_OK) {
int G_debug(int level, const char *msg,...)
Print debugging message.
void G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int IL_check_at_points_2d(struct interp_params *params, struct quaddata *data, double *b, double *ertot, double zmin, double dnorm, struct triple *skip_point)
int IL_write_point_2d(struct triple point, double err)
A function to write out point and deviation at point to database.
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)