PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ rect_tree_contains_point()

int rect_tree_contains_point ( const RECT_NODE tree,
const POINT2D pt,
int *  on_boundary 
)

Definition at line 58 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().

59 {
60  if ( FP_CONTAINS_INCL(node->ymin, pt->y, node->ymax) )
61  {
62  if ( rect_node_is_leaf(node) )
63  {
64  double side = lw_segment_side(node->p1, node->p2, pt);
65  if ( side == 0 )
66  *on_boundary = LW_TRUE;
67  return (side < 0 ? -1 : 1 );
68  }
69  else
70  {
71  return rect_tree_contains_point(node->left_node, pt, on_boundary) +
72  rect_tree_contains_point(node->right_node, pt, on_boundary);
73  }
74  }
75  /* printf("NOT in measure range\n"); */
76  return 0;
77 }
#define FP_CONTAINS_INCL(A, X, B)
static int rect_node_is_leaf(const RECT_NODE *node)
Internal nodes have their point references set to NULL.
Definition: lwtree.c:33
int rect_tree_contains_point(const RECT_NODE *node, const POINT2D *pt, int *on_boundary)
Definition: lwtree.c:58
#define LW_TRUE
Return types for functions with status returns.
Definition: liblwgeom.h:75
double y
Definition: liblwgeom.h:327
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
Definition: lwalgorithm.c:64
Here is the call graph for this function:
Here is the caller graph for this function: