PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ rect_node_internal_new()

RECT_NODE* rect_node_internal_new ( RECT_NODE left_node,
RECT_NODE right_node 
)

Create a new internal node, calculating the new measure range for the node, and storing pointers to the child nodes.

Definition at line 156 of file lwtree.c.

References FP_MAX, FP_MIN, rect_node::left_node, lwalloc(), rect_node::p1, rect_node::p2, rect_node::right_node, rect_node::xmax, rect_node::xmin, rect_node::ymax, and rect_node::ymin.

Referenced by rect_tree_new().

157 {
158  RECT_NODE *node = lwalloc(sizeof(RECT_NODE));
159  node->p1 = NULL;
160  node->p2 = NULL;
161  node->xmin = FP_MIN(left_node->xmin, right_node->xmin);
162  node->xmax = FP_MAX(left_node->xmax, right_node->xmax);
163  node->ymin = FP_MIN(left_node->ymin, right_node->ymin);
164  node->ymax = FP_MAX(left_node->ymax, right_node->ymax);
165  node->left_node = left_node;
166  node->right_node = right_node;
167  return node;
168 }
struct rect_node * right_node
Definition: lwtree.h:32
POINT2D * p1
Definition: lwtree.h:33
#define FP_MIN(A, B)
POINT2D * p2
Definition: lwtree.h:34
double xmax
Definition: lwtree.h:28
double ymax
Definition: lwtree.h:30
double xmin
Definition: lwtree.h:27
double ymin
Definition: lwtree.h:29
void * lwalloc(size_t size)
Definition: lwutil.c:229
struct rect_node * left_node
Definition: lwtree.h:31
#define FP_MAX(A, B)
Here is the call graph for this function:
Here is the caller graph for this function: