|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-ddeab64dbf
|
Vector library - polygon related fns. More...
#include <math.h>#include <stdlib.h>#include <grass/vector.h>#include <grass/linkm.h>#include <grass/glocale.h>
Go to the source code of this file.
Vector library - polygon related fns.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2009 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file Vlib/poly.c.
| int Vect__intersect_x_line_with_poly | ( | const struct line_pnts * | Points, |
| double | x, | ||
| struct line_pnts * | Inter | ||
| ) |
Definition at line 169 of file Vlib/poly.c.
References b, line_pnts::n_points, Vect_append_point(), line_pnts::x, and line_pnts::y.
Referenced by Vect_get_point_in_poly_isl().
| int Vect__intersect_y_line_with_poly | ( | const struct line_pnts * | Points, |
| double | y, | ||
| struct line_pnts * | Inter | ||
| ) |
Definition at line 126 of file Vlib/poly.c.
References b, line_pnts::n_points, Vect_append_point(), line_pnts::x, and line_pnts::y.
Referenced by Vect_get_point_in_poly_isl().
Get centroid of polygon.
| points | polygon | |
| [out] | cent_x,cent_y | centroid coordinates |
Definition at line 355 of file Vlib/poly.c.
References line_pnts::n_points, line_pnts::x, and line_pnts::y.
Referenced by Vect_get_point_in_poly(), and Vect_get_point_in_poly_isl().
Get point inside area and outside all islands.
Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.
| Map | vector map | |
| area | area id | |
| [out] | X,Y | point coordinateds |
Definition at line 55 of file Vlib/poly.c.
References G_debug(), G_realloc, NULL, Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_isle_points(), Vect_get_point_in_poly_isl(), Vect_new_line_struct(), X, and Y.
Get point inside polygon.
This does NOT consider ISLANDS!
| Points | polygon | |
| [out] | X,Y | point coordinates |
Definition at line 208 of file Vlib/poly.c.
References _, G_debug(), G_warning(), link_exit_on_error(), link_init(), link_new(), line_pnts::n_points, NULL, Vect_find_poly_centroid(), Vect_point_in_poly(), X, line_pnts::x, x, and Y.
Referenced by V2_write_line_sfa().
| int Vect_get_point_in_poly_isl | ( | const struct line_pnts * | Points, |
| const struct line_pnts ** | IPoints, | ||
| int | n_isles, | ||
| double * | att_x, | ||
| double * | att_y | ||
| ) |
Get point inside polygon but outside the islands specifiled in IPoints.
Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.
| Points | polygon (boundary) | |
| IPoints | isles (list of isle boundaries) | |
| n_isles | number of isles | |
| [out] | att_x,att_y | point coordinates |
Definition at line 449 of file Vlib/poly.c.
References G_debug(), G_warning(), max, line_pnts::n_points, Vect__intersect_x_line_with_poly(), Vect__intersect_y_line_with_poly(), Vect_find_poly_centroid(), Vect_new_line_struct(), Vect_point_in_poly(), line_pnts::x, and line_pnts::y.
Referenced by Vect_get_point_in_area().
| int Vect_point_in_area_outer_ring | ( | double | X, |
| double | Y, | ||
| struct Map_info * | Map, | ||
| int | area, | ||
| struct bound_box * | box | ||
| ) |
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.
| X,Y | point coordinates |
| Map | vector map |
| area | area id |
| box | area bounding box |
Definition at line 854 of file Vlib/poly.c.
References bound_box::E, G_debug(), P_area::lines, bound_box::N, P_area::n_lines, NULL, Vect_new_line_struct(), Vect_read_line(), W, X, and Y.
Referenced by Vect_find_area(), Vect_isle_find_area(), and Vect_point_in_area().
| int Vect_point_in_island | ( | double | X, |
| double | Y, | ||
| struct Map_info * | Map, | ||
| int | isle, | ||
| struct bound_box * | box | ||
| ) |
Determines if a point (X,Y) is inside an island.
| X,Y | point coordinates |
| Map | vector map |
| isle | isle id |
| box | isle bounding box |
Definition at line 923 of file Vlib/poly.c.
References bound_box::E, G_debug(), P_isle::lines, bound_box::N, P_isle::n_lines, NULL, Vect_new_line_struct(), Vect_read_line(), W, X, and Y.
Referenced by Vect_find_area(), Vect_find_island(), and Vect_point_in_area().
Determines if a point (X,Y) is inside a polygon.
| X,Y | point coordinates |
| Points | polygon |
Definition at line 824 of file Vlib/poly.c.
References G_debug(), line_pnts::n_points, X, and Y.
Referenced by Vect_get_point_in_poly(), Vect_get_point_in_poly_isl(), and Vect_select_lines_by_polygon().