19static int extend_lines(
struct Map_info *,
int,
int,
int,
int,
double,
21static int find_extended_intersection(
double,
double,
double,
double,
double,
22 double,
double *,
double *);
23static int check_extended_direction(
double,
double,
double,
int,
double,
69 int parallel,
double thresh)
94 for (i = 0; i <
List->n_values; i++) {
97 line =
List->value[i];
105 node[0] = node[1] = -1;
107 if (node[0] < 0 || node[1] < 0)
129 G_debug(3,
"Vedit_extend_lines(): lines=%d,%d", line,
134 "Vedit_extend_lines(): lines=%d,%d -> extended",
182 double x, y,
px,
py, x1, y1;
202 if (!(seg > 0 && dist > 0.0 && (
thresh < 0. || dist <=
thresh)))
233 if (!check_extended_direction(x, y,
angle_f, first, x1, y1))
266 if (!check_extended_direction(x2, y2,
angle_t, seg == 1, x1,
312 for (
is = 0;
is < seg;
is++)
352static int find_extended_intersection(
double x1,
double y1,
double angle1,
353 double x2,
double y2,
double angle2,
354 double *x,
double *y)
384 a = (-
s2 * (x2 - x1) +
c2 * (y2 - y1)) / d;
391static int check_extended_direction(
double x,
double y,
double angle,
392 int start_node,
double extx,
double exty)
402 xdir = (
fabs(tmp) <=
TOL ? 0 : (tmp > 0 ? 1 : -1));
404 ydir = (
fabs(tmp) <=
TOL ? 0 : (tmp > 0 ? 1 : -1));
408 xext = (
fabs(tmp) <=
TOL ? 0 : (tmp > 0 ? 1 : -1));
410 yext = (
fabs(tmp) <=
TOL ? 0 : (tmp > 0 ? 1 : -1));
421 else if (
xext == 0) {
int G_debug(int, const char *,...) __attribute__((format(printf
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
off_t Vect_rewrite_line(struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *)
Rewrites existing feature (topological level required)
int Vect_get_line_nodes(struct Map_info *, int, int *, int *)
Get line nodes.
int Vect_get_node_coor(struct Map_info *, int, double *, double *, double *)
Get node coordinates.
double Vect_line_length(const struct line_pnts *)
Calculate line length, 3D-length in case of 3D vector line.
int Vect_point_on_line(const struct line_pnts *, double, double *, double *, double *, double *, double *)
Find point on line in the specified distance.
int Vect_get_line_type(struct Map_info *, int)
Get line type.
int Vect_find_line_list(struct Map_info *, double, double, double, int, double, int, const struct ilist *, struct ilist *)
Find the nearest line(s).
void Vect_destroy_list(struct ilist *)
Frees all memory associated with a struct ilist, including the struct itself.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_list_append(struct ilist *, int)
Append new item to the end of list if not yet present.
int Vect_read_line(struct Map_info *, struct line_pnts *, struct line_cats *, int)
Read vector feature (topological level required)
int Vect_line_distance(const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *)
Calculate distance of point to line.
int Vect_line_alive(struct Map_info *, int)
Check if feature is alive or dead (topological level required)
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
struct ilist * Vect_new_list(void)
Creates and initializes a struct ilist.
int Vect_line_insert_point(struct line_pnts *, int, double, double, double)
Insert new point at index position and move all old points at that position and above up.
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
void Vect_reset_line(struct line_pnts *)
Reset line.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_reset_list(struct ilist *)
Reset ilist structure.
int Vect_append_point(struct line_pnts *, double, double, double)
Appends one point to the end of a line.
#define WITHOUT_Z
2D/3D vector data
int Vedit_extend_lines(struct Map_info *Map, struct ilist *List, int nodes, int parallel, double thresh)
Extend lines in given threshold.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
Feature geometry info - coordinates.