PostGIS  2.1.10dev-r@@SVN_REVISION@@
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 132 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().

133 {
134  RECT_NODE *node = lwalloc(sizeof(RECT_NODE));
135  node->p1 = NULL;
136  node->p2 = NULL;
137  node->xmin = FP_MIN(left_node->xmin, right_node->xmin);
138  node->xmax = FP_MAX(left_node->xmax, right_node->xmax);
139  node->ymin = FP_MIN(left_node->ymin, right_node->ymin);
140  node->ymax = FP_MAX(left_node->ymax, right_node->ymax);
141  node->left_node = left_node;
142  node->right_node = right_node;
143  return node;
144 }
struct rect_node * right_node
Definition: lwtree.h:11
POINT2D * p1
Definition: lwtree.h:12
#define FP_MIN(A, B)
POINT2D * p2
Definition: lwtree.h:13
double xmax
Definition: lwtree.h:7
double ymax
Definition: lwtree.h:9
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
Definition: lwtree.h:4
double xmin
Definition: lwtree.h:6
double ymin
Definition: lwtree.h:8
void * lwalloc(size_t size)
Definition: lwutil.c:175
struct rect_node * left_node
Definition: lwtree.h:10
#define FP_MAX(A, B)

Here is the call graph for this function:

Here is the caller graph for this function: