GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-36359e2344
|
Vector library - bounding box. More...
Go to the source code of this file.
Functions | |
int | Vect_point_in_box (double x, double y, double z, const struct bound_box *Box) |
Tests if point is in 3D box. More... | |
int | Vect_point_in_box_2d (double x, double y, const struct bound_box *Box) |
Tests if point is in 2D box. More... | |
int | Vect_box_overlap (const struct bound_box *A, const struct bound_box *B) |
Tests for overlap of two boxes. More... | |
int | Vect_box_copy (struct bound_box *A, const struct bound_box *B) |
Copy box B to box A. More... | |
int | Vect_box_extend (struct bound_box *A, const struct bound_box *B) |
Extend box A by box B. More... | |
int | Vect_box_clip (double *x, double *y, double *c_x, double *c_y, const struct bound_box *Box) |
Clip coordinates to box, if necessary, lines extending outside of a box. More... | |
int | Vect_get_line_box (struct Map_info *Map, int line, struct bound_box *Box) |
Get bounding box of given feature. More... | |
int | Vect_get_area_box (struct Map_info *Map, int area, struct bound_box *Box) |
Get bounding box of area. More... | |
int | Vect_get_isle_box (struct Map_info *Map, int isle, struct bound_box *Box) |
Get bounding box of isle. More... | |
int | Vect_get_map_box (struct Map_info *Map, struct bound_box *Box) |
Get bounding box of map (all features in the map) More... | |
int | Vect_get_map_box1 (struct Map_info *Map, struct bound_box *Box) |
Get bounding box of map on level 1 (all features in the map) More... | |
int | Vect_region_box (const struct Cell_head *Window, struct bound_box *Box) |
Copy region window to bounding box. More... | |
Vector library - bounding box.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2015 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 vector/Vlib/box.c.
int Vect_box_clip | ( | double * | x, |
double * | y, | ||
double * | c_x, | ||
double * | c_y, | ||
const struct bound_box * | Box | ||
) |
Clip coordinates to box, if necessary, lines extending outside of a box.
A line represented by the coordinates x, y and c_x, c_y is clipped to the window defined by s (south), n (north), w (west), and e (east). Note that the following constraints must be true: w <e s <n The x and c_x are values to be compared to w and e. The y and c_y are values to be compared to s and n. The x and c_x values returned lie between w and e. The y and c_y values returned lie between s and n.
x,y | coordinates (w, e) |
c_x,c_y | coordinates (s, n) |
Box | boundary box |
Definition at line 162 of file vector/Vlib/box.c.
Copy box B to box A.
A | boundary A |
B | boundary B |
Definition at line 101 of file vector/Vlib/box.c.
Referenced by Vect_get_map_box().
Extend box A by box B.
A | boundary A |
B | boundary B |
Definition at line 122 of file vector/Vlib/box.c.
Tests for overlap of two boxes.
A | boundary box A |
B | boundary box B |
Definition at line 82 of file vector/Vlib/box.c.
Get bounding box of area.
Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.
Map | vector map | |
area | area id | |
[out] | Box | bounding box |
Definition at line 300 of file vector/Vlib/box.c.
References _, Plus_head::Area, Box, dig_find_area_box(), G_warning(), Plus_head::n_areas, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by Vect__insert_face_pg(), and Vect_attach_isles().
Get bounding box of isle.
Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.
Map | vector map | |
isle | isle id | |
[out] | Box | bounding box |
Definition at line 345 of file vector/Vlib/box.c.
References _, Box, dig_find_isle_box(), G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by Vect__insert_face_pg().
Get bounding box of given feature.
Vector map must be open at topological level and built with level >= GV_BUILD_BASE.
Map | vector map | |
line | feature id | |
[out] | Box | bounding box |
Definition at line 235 of file vector/Vlib/box.c.
Get bounding box of map (all features in the map)
Requires level 2. On level 1 error code is returned.
Map | vector map | |
[out] | Box | bounding box |
Definition at line 388 of file vector/Vlib/box.c.
References Plus_head::box, Box, Map_info::plus, Vect_box_copy(), and Vect_level().
Get bounding box of map on level 1 (all features in the map)
This subroutine determines bounding box by reading all features sequentially.
Map | vector map | |
[out] | Box | bounding box |
Definition at line 413 of file vector/Vlib/box.c.
int Vect_point_in_box | ( | double | x, |
double | y, | ||
double | z, | ||
const struct bound_box * | Box | ||
) |
Tests if point is in 3D box.
This function considers 3D point and 3D bounding box.
struct bound_box bbox; bbox.N = 135; bbox.S = 125; bbox.E = 220; bbox.W = 215; bbox.T = 340; bbox.B = 330; Vect_point_in_box(217, 130, 335, &bbox);
x | coordinate (W-E direction) |
y | coordinate (S-N direction) |
z | coordinate (B-T direction) |
Box | boundary box |
Definition at line 48 of file vector/Vlib/box.c.
Referenced by P_Mean_Calc().
int Vect_point_in_box_2d | ( | double | x, |
double | y, | ||
const struct bound_box * | Box | ||
) |
Tests if point is in 2D box.
Only x and y are tested. Top and bottom of the bounding box are ignored.
x | coordinate (W-E direction) |
y | coordinate (S-N direction) |
Box | boundary box (only W, E, S, N are used) |
Definition at line 67 of file vector/Vlib/box.c.
Copy region window to bounding box.
Window | region structure (raster-based) | |
[out] | Box | boundary box (vector-based) |
Definition at line 461 of file vector/Vlib/box.c.
References Box, Cell_head::east, Cell_head::north, PORT_DOUBLE_MAX, Cell_head::south, and Cell_head::west.
Referenced by P_Mean_Calc().