GRASS GIS 7 Programmer's Manual
7.9.dev(2020)f4bc66038

Vector library  bounding box. More...
#include <stdlib.h>
#include <grass/vector.h>
#include <grass/glocale.h>
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 (const struct Map_info *Map, int line, struct bound_box *Box) 
Get bounding box of given feature. More...  
int  Vect_get_area_box (const struct Map_info *Map, int area, struct bound_box *Box) 
Get bounding box of area. More...  
int  Vect_get_isle_box (const struct Map_info *Map, int isle, struct bound_box *Box) 
Get bounding box of isle. More...  
int  Vect_get_map_box (const 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) 20012015 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 167 of file vector/Vlib/box.c.
References bound_box::E, bound_box::N, bound_box::S, bound_box::W, W, and x.
Copy box B to box A.
A  boundary A 
B  boundary B 
Definition at line 103 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 124 of file vector/Vlib/box.c.
Tests for overlap of two boxes.
A  boundary box A 
B  boundary box B 
Definition at line 84 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 306 of file vector/Vlib/box.c.
References _, Plus_head::Area, bound_box::B, dig_find_area_box(), bound_box::E, G_warning(), bound_box::N, Plus_head::n_areas, NULL, Map_info::plus, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, Vect_is_3d(), and bound_box::W.
Referenced by 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 351 of file vector/Vlib/box.c.
References _, bound_box::B, dig_find_isle_box(), bound_box::E, G_warning(), Plus_head::Isle, bound_box::N, Plus_head::n_isles, NULL, Map_info::plus, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, Vect_is_3d(), and bound_box::W.
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 240 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 394 of file vector/Vlib/box.c.
References Plus_head::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 419 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 (WE direction) 
y  coordinate (SN direction) 
z  coordinate (BT direction) 
Box  boundary box 
Definition at line 48 of file vector/Vlib/box.c.
References bound_box::B, N, bound_box::S, and bound_box::W.
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 (WE direction) 
y  coordinate (SN direction) 
Box  boundary box (only W, E, S, N are used) 
Definition at line 68 of file vector/Vlib/box.c.
References N, bound_box::S, and bound_box::W.
Copy region window to bounding box.
Window  region structure (rasterbased)  
[out]  Box  boundary box (vectorbased) 
Definition at line 467 of file vector/Vlib/box.c.
References bound_box::B, bound_box::E, Cell_head::east, bound_box::N, Cell_head::north, PORT_DOUBLE_MAX, bound_box::S, Cell_head::south, bound_box::T, bound_box::W, and Cell_head::west.
Referenced by P_Mean_Calc().