35 #include <grass/interpf.h> 64 double east = data->
xmax;
65 double west = data->
x_orig;
66 double north = data->
ymax;
67 double south = data->
y_orig;
68 double rfsta2, errmax, h, xx, yy, r2, hz, zz,
err, xmm, ymm,
r;
81 fstar2 = params->
fi * params->
fi / 4.;
84 for (mm = 1; mm <= n_points; mm++) {
86 for (m = 1; m <= n_points; m++) {
87 xx = points[mm - 1].
x - points[m - 1].
x;
88 yy = points[mm - 1].
y - points[m - 1].
y;
89 r2 = yy * yy + xx * xx;
93 h = h + b[m] * params->
interp(r, params->
fi);
102 zz = points[mm - 1].
z + zmin;
104 xmm = points[mm - 1].
x * dnorm + params->
x_orig + west;
105 ymm = points[mm - 1].
y * dnorm + params->
y_orig + south;
106 if ((xmm >= west + params->
x_orig) && (xmm <= east + params->x_orig)
107 && (ymm >= south + params->
y_orig) &&
108 (ymm <= north + params->y_orig))
125 sprintf(buf,
"insert into %s values ( %d ",
ff->
table, cat);
128 sprintf(buf,
", %f", err);
143 (*ertot) += err *
err;
149 for (m = 1; m <= n_points - 1; m++) {
150 xx = points[m - 1].
x - skip_point.
x;
151 yy = points[m - 1].
y - skip_point.
y;
152 r2 = yy * yy + xx * xx;
154 rfsta2 = fstar2 * r2;
156 h = h + b[m] * params->
interp(r, params->
fi);
160 zz = skip_point.
z + zmin;
162 xmm = skip_point.
x * dnorm + params->
x_orig + west;
163 ymm = skip_point.
y * dnorm + params->
y_orig + south;
165 if ((xmm >= west + params->
x_orig) && (xmm <= east + params->x_orig)
166 && (ymm >= south + params->
y_orig) &&
167 (ymm <= north + params->y_orig))
182 sprintf(buf,
"insert into %s values ( %d ",
ff->
table, cat);
185 sprintf(buf,
", %f", skip_err);
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)
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
char * db_get_string(const dbString *)
Get string.
char * table
Name of DB table.
#define GV_POINT
Feature types used in memory on run time (may change)
SYMBOL * err(FILE *fp, SYMBOL *s, char *msg)
int db_append_string(dbString *, const char *)
Append string to dbString.
int db_close_database(dbDriver *)
Close database connection.
int db_execute_immediate(dbDriver *, dbString *)
Execute SQL statements.
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
int db_shutdown_driver(dbDriver *)
Closedown the driver, and free the driver structure.
void db_zero_string(dbString *)
Zero string.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int G_debug(int, const char *,...) __attribute__((format(printf
void Vect_reset_line(struct line_pnts *)
Reset line.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.