PostGIS 3.7.0dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ rect_node_min_distance()

static double rect_node_min_distance ( const RECT_NODE n1,
const RECT_NODE n2 
)
inlinestatic

Definition at line 1042 of file lwtree.c.

1043{
1044 int left = n1->xmin > n2->xmax;
1045 int right = n1->xmax < n2->xmin;
1046 int bottom = n1->ymin > n2->ymax;
1047 int top = n1->ymax < n2->ymin;
1048
1049 //lwnotice("rect_node_min_distance");
1050
1051 if (top && left)
1052 return distance(n1->xmin, n1->ymax, n2->xmax, n2->ymin);
1053 else if (top && right)
1054 return distance(n1->xmax, n1->ymax, n2->xmin, n2->ymin);
1055 else if (bottom && left)
1056 return distance(n1->xmin, n1->ymin, n2->xmax, n2->ymax);
1057 else if (bottom && right)
1058 return distance(n1->xmax, n1->ymin, n2->xmin, n2->ymax);
1059 else if (left)
1060 return n1->xmin - n2->xmax;
1061 else if (right)
1062 return n2->xmin - n1->xmax;
1063 else if (bottom)
1064 return n1->ymin - n2->ymax;
1065 else if (top)
1066 return n2->ymin - n1->ymax;
1067 else
1068 return 0.0;
1069
1070 return 0.0;
1071}
static double distance(double x1, double y1, double x2, double y2)
Definition lwtree.c:1032
double ymin
Definition lwtree.h:71
double xmax
Definition lwtree.h:70
double ymax
Definition lwtree.h:72
double xmin
Definition lwtree.h:69

References distance(), rect_node::xmax, rect_node::xmin, rect_node::ymax, and rect_node::ymin.

Referenced by rect_tree_distance_tree_recursive().

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