Walk the tree and count intersections between the stab line and the edges.
odd => containment, even => no containment. KNOWN PROBLEM: Grazings (think of a sharp point, just touching the stabline) will be counted for one, which will throw off the count.
Definition at line 455 of file lwgeodetic_tree.c.
References circ_node::center, circ_node_is_leaf(), circ_tree_contains_point(), edge_distance_to_point(), edge_intersects(), circ_node::edge_num, GEOGRAPHIC_EDGE::end, FP_LTEQ, geog2cart(), geographic_point_init(), GEOGRAPHIC_POINT::lat, GEOGRAPHIC_POINT::lon, LWDEBUG, LWDEBUGF, circ_node::nodes, circ_node::num_nodes, circ_node::p1, circ_node::p2, PIR_B_TOUCH_RIGHT, PIR_COLINEAR, PIR_INTERSECTS, rad2deg, circ_node::radius, GEOGRAPHIC_EDGE::start, POINT2D::x, and POINT2D::y.
Referenced by circ_tree_contains_point(), circ_tree_distance_tree_internal(), CircTreePIP(), test_tree_circ_pip(), and test_tree_circ_pip2().
478 LWDEBUGF(3,
"edge_distance_to_point=%g, node_radius=%g", d, node->
radius);
481 LWDEBUGF(3,
"entering this branch (%p)", node);
497 LWDEBUG(3,
" got stab line edge_intersection with this edge!");
503 LWDEBUG(3,
" rejecting stab line grazing by left-side edge");
508 LWDEBUG(3,
" accepting stab line intersection");
519 LWDEBUG(3,
"internal node calculation");
520 LWDEBUGF(3,
" calling circ_tree_contains_point on child %d!", i);
528 LWDEBUGF(3,
"skipping this branch (%p)", node);
Two-point great circle segment from a to b.
#define PIR_B_TOUCH_RIGHT
#define LWDEBUG(level, msg)
Point in spherical coordinates on the world.
static int circ_node_is_leaf(const CIRC_NODE *node)
Internal nodes have their point references set to NULL.
double edge_distance_to_point(const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *gp, GEOGRAPHIC_POINT *closest)
int circ_tree_contains_point(const CIRC_NODE *node, const POINT2D *pt, const POINT2D *pt_outside, int *on_boundary)
Walk the tree and count intersections between the stab line and the edges.
void geog2cart(const GEOGRAPHIC_POINT *g, POINT3D *p)
Convert spherical coordinates to cartesion coordinates on unit sphere.
int edge_intersects(const POINT3D *A1, const POINT3D *A2, const POINT3D *B1, const POINT3D *B2)
Returns non-zero if edges A and B interact.
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
#define LWDEBUGF(level, msg,...)
struct circ_node ** nodes