PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ rect_tree_distance_tree()

double rect_tree_distance_tree ( RECT_NODE n1,
RECT_NODE n2,
double  threshold 
)

Return the distance between two RECT_NODE trees.

Definition at line 1354 of file lwtree.c.

1355 {
1356  double distance;
1358 
1359  /*
1360  * It is possible for an area to intersect another object
1361  * without any edges intersecting, if the object is fully contained.
1362  * If that is so, then any point in the object will be contained,
1363  * so we do a quick point-in-poly test first for those cases
1364  */
1365  if (rect_tree_is_area(n1) &&
1367  {
1368  return 0.0;
1369  }
1370 
1371  if (rect_tree_is_area(n2) &&
1373  {
1374  return 0.0;
1375  }
1376 
1377  state.threshold = threshold;
1378  state.min_dist = FLT_MAX;
1379  state.max_dist = FLT_MAX;
1380  distance = rect_tree_distance_tree_recursive(n1, n2, &state);
1381  // *p1 = state.p1;
1382  // *p2 = state.p2;
1383  return distance;
1384 }
static double rect_tree_distance_tree_recursive(RECT_NODE *n1, RECT_NODE *n2, RECT_TREE_DISTANCE_STATE *state)
Definition: lwtree.c:1290
int rect_tree_contains_point(RECT_NODE *node, const POINT2D *pt)
Definition: lwtree.c:398
static int rect_tree_is_area(const RECT_NODE *node)
Definition: lwtree.c:436
static double distance(double x1, double y1, double x2, double y2)
Definition: lwtree.c:1032
static const POINT2D * rect_tree_get_point(const RECT_NODE *node)
Definition: lwtree.c:897

References distance(), rect_tree_distance_state::max_dist, rect_tree_distance_state::min_dist, rect_tree_contains_point(), rect_tree_distance_tree_recursive(), rect_tree_get_point(), rect_tree_is_area(), and rect_tree_distance_state::threshold.

Referenced by ST_DistanceRectTree(), ST_DistanceRectTreeCached(), and test_rect_tree_distance_tree_case().

Here is the call graph for this function:
Here is the caller graph for this function: