Changeset 66459
- Timestamp:
- Oct 9, 2015, 4:51:11 PM (9 years ago)
- Location:
- grass/trunk/lib/vector/Vlib
- Files:
-
- 2 added
- 1 edited
-
box.c (modified) (3 diffs)
-
testsuite (added)
-
testsuite/test_vlib_box.py (added)
Legend:
- Unmodified
- Added
- Removed
-
grass/trunk/lib/vector/Vlib/box.c
r55580 r66459 6 6 Higher level functions for reading/writing/manipulating vectors. 7 7 8 (C) 2001-20 09by the GRASS Development Team8 (C) 2001-2015 by the GRASS Development Team 9 9 10 10 This program is free software under the … … 21 21 22 22 /*! 23 \brief Tests for point in box 24 25 \param x,y,z coordinates 26 \param Box boundary box 27 28 \return 1 point is in box 29 \return 0 point is not in box 23 \brief Tests if point is in 3D box 24 25 This function considers 3D point and 3D bounding box. 26 27 \par Example 28 29 \verbatim 30 struct bound_box bbox; 31 bbox.N = 135; 32 bbox.S = 125; 33 bbox.E = 220; 34 bbox.W = 215; 35 bbox.T = 340; 36 bbox.B = 330; 37 Vect_point_in_box(217, 130, 335, &bbox); 38 \endverbatim 39 40 \param x coordinate (W-E direction) 41 \param y coordinate (S-N direction) 42 \param z coordinate (B-T direction) 43 \param Box boundary box 44 45 \returns 1 if point is in box 46 \returns 0 if point is not in box 30 47 */ 31 48 int Vect_point_in_box(double x, double y, double z, const struct bound_box *Box) … … 35 52 y >= Box->S && y <= Box->N && 36 53 z >= Box->B && z <= Box->T); 54 } 55 56 /*! 57 \brief Tests if point is in 2D box 58 59 Only x and y are tested. Top and bottom of the bounding box are ignored. 60 61 \param x coordinate (W-E direction) 62 \param y coordinate (S-N direction) 63 \param Box boundary box (only W, E, S, N are used) 64 65 \returns 1 if point is in box 66 \returns 0 if point is not in box 67 */ 68 int Vect_point_in_box_2d(double x, double y, const struct bound_box *Box) 69 { 70 71 return (x >= Box->W && x <= Box->E && 72 y >= Box->S && y <= Box->N); 37 73 } 38 74
Note:
See TracChangeset
for help on using the changeset viewer.
