|
GRASS 8 Programmer's Manual 8.6.0dev(2026)-fc1694ea64
|
Vector library - bounding box. More...

Go to the source code of this file.
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.
References bound_box::B, bound_box::E, bound_box::N, bound_box::S, bound_box::T, and bound_box::W.
Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), V2_write_line_sfa(), Vect_build_nat(), Vect_get_map_box(), Vect_get_map_box1(), and Vect_topo_dump().
Extend box A by box B.
| A | boundary A |
| B | boundary B |
Definition at line 122 of file vector/Vlib/box.c.
References bound_box::B, bound_box::E, bound_box::N, bound_box::S, bound_box::T, and bound_box::W.
Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), V2_write_line_sfa(), Vect_build_nat(), and Vect_get_map_box1().
Tests for overlap of two boxes.
| A | boundary box A |
| B | boundary box B |
Definition at line 82 of file vector/Vlib/box.c.
References bound_box::B, bound_box::E, bound_box::N, bound_box::S, bound_box::T, and bound_box::W.
Referenced by line_check_intersection2(), V1_read_next_line_nat(), V2_read_next_line_nat(), V2_read_next_line_ogr(), V2_read_next_line_pg(), Vect_line_intersection(), and Vect_line_intersection2().
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(), NULL, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), V2_read_line_sfa(), V2_read_next_line_ogr(), V2_read_next_line_pg(), Vect__insert_face_pg(), Vect_attach_centroids(), 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, NULL, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), Vect__insert_face_pg(), Vect_build_nat(), Vect_find_area(), and Vect_point_in_area().
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.
References _, Box, dig_find_line_box(), dig_line_box(), G_warning(), GV_LINES, Plus_head::Line, NULL, PORT_DOUBLE_MAX, P_line::type, Vect_is_3d(), Vect_new_line_struct(), and Vect_read_line().
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 Box, 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.
References _, Box, dig_line_box(), FALSE, G_free(), G_verbose_message(), G_warning(), NULL, TRUE, Vect_box_copy(), Vect_box_extend(), Vect_destroy_line_struct(), Vect_get_full_name(), Vect_new_line_struct(), Vect_read_next_line(), and Vect_rewind().
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_estimate_splinestep(), P_Mean_Calc(), P_Read_Raster_Region_Map(), P_Read_Vector_Region_Map(), P_Regular_Points(), and P_Sparse_Points().
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 463 of file vector/Vlib/box.c.
References Box, and PORT_DOUBLE_MAX.
Referenced by P_estimate_splinestep(), P_Mean_Calc(), P_Read_Raster_Region_Map(), and P_Read_Vector_Region_Map().