PostGIS  2.2.7dev-r@@SVN_REVISION@@
int rect_tree_contains_point ( const RECT_NODE node,
const POINT2D pt,
int *  on_boundary 
)

Definition at line 34 of file lwtree.c.

References FP_CONTAINS_INCL, rect_node::left_node, lw_segment_side(), LW_TRUE, rect_node::p1, rect_node::p2, rect_node_is_leaf(), rect_tree_contains_point(), rect_node::right_node, POINT2D::y, rect_node::ymax, and rect_node::ymin.

Referenced by rect_tree_contains_point(), and test_rect_tree_contains_point().

35 {
36  if ( FP_CONTAINS_INCL(node->ymin, pt->y, node->ymax) )
37  {
38  if ( rect_node_is_leaf(node) )
39  {
40  double side = lw_segment_side(node->p1, node->p2, pt);
41  if ( side == 0 )
42  *on_boundary = LW_TRUE;
43  return (side < 0 ? -1 : 1 );
44  }
45  else
46  {
47  return rect_tree_contains_point(node->left_node, pt, on_boundary) +
48  rect_tree_contains_point(node->right_node, pt, on_boundary);
49  }
50  }
51  /* printf("NOT in measure range\n"); */
52  return 0;
53 }
struct rect_node * right_node
Definition: lwtree.h:11
POINT2D * p1
Definition: lwtree.h:12
#define FP_CONTAINS_INCL(A, X, B)
POINT2D * p2
Definition: lwtree.h:13
static int rect_node_is_leaf(const RECT_NODE *node)
Internal nodes have their point references set to NULL.
Definition: lwtree.c:9
int rect_tree_contains_point(const RECT_NODE *node, const POINT2D *pt, int *on_boundary)
Definition: lwtree.c:34
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:61
double ymax
Definition: lwtree.h:9
double y
Definition: liblwgeom.h:312
double ymin
Definition: lwtree.h:8
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
Definition: lwalgorithm.c:50
struct rect_node * left_node
Definition: lwtree.h:10

Here is the call graph for this function:

Here is the caller graph for this function: