35 return (node->
p1 != NULL);
67 return (side < 0 ? -1 : 1 );
81 LWDEBUGF(4,
"n1 (%.9g %.9g,%.9g %.9g) vs n2 (%.9g %.9g,%.9g %.9g)",n1->
xmin,n1->
ymin,n1->
xmax,n1->
ymax,n2->
xmin,n2->
ymin,n2->
xmax,n2->
ymax);
85 LWDEBUG(4,
" interaction found");
98 LWDEBUG(4,
" internal node found, recursing");
118 LWDEBUG(4,
" no interaction found");
177 int num_edges, num_children, num_parents;
197 for ( i = 0; i < num_edges; i++ )
215 num_parents = num_children / 2;
216 while ( num_parents > 0 )
219 while ( j < num_parents )
230 if ( num_children % 2 )
232 nodes[j] = nodes[num_children - 1];
235 num_children = num_parents;
236 num_parents = num_children / 2;
struct rect_node * right_node
#define LWDEBUG(level, msg)
#define FP_CONTAINS_INCL(A, X, B)
RECT_NODE * rect_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge, and each with an associated measure rang...
static int rect_node_is_leaf(const RECT_NODE *node)
Internal nodes have their point references set to NULL.
int rect_tree_contains_point(const RECT_NODE *node, const POINT2D *pt, int *on_boundary)
#define LW_TRUE
Return types for functions with status returns.
uint8_t * getPoint_internal(const POINTARRAY *pa, int n)
RECT_NODE * rect_node_leaf_new(const POINTARRAY *pa, int i)
Create a new leaf node, calculating a measure value for each point on the edge and storing pointers b...
int rect_tree_intersects_tree(const RECT_NODE *n1, const RECT_NODE *n2)
void rect_tree_free(RECT_NODE *node)
Recurse from top of node tree and free all children.
void * lwalloc(size_t size)
int lw_segment_side(const POINT2D *p1, const POINT2D *p2, const POINT2D *q)
lw_segment_side()
#define LWDEBUGF(level, msg,...)
struct rect_node * left_node
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 t...
int lw_segment_intersects(const POINT2D *p1, const POINT2D *p2, const POINT2D *q1, const POINT2D *q2)
returns the kind of CG_SEGMENT_INTERSECTION_TYPE behavior of lineseg 1 (constructed from p1 and p2) a...