645 if( *min_dist < threshold || *min_dist == 0.0 )
651 LWDEBUGF(4,
"pruning pair %p, %p", n1, n2);
658 if( max < *max_dist )
667 LWDEBUGF(4,
"n1 is polygon, testing if contains (%.5g,%.5g)", pt.
x, pt.
y);
683 LWDEBUGF(4,
"n2 is polygon, testing if contains (%.5g,%.5g)", pt.
x, pt.
y);
701 if ( n1->
p1 == n1->
p2 || n2->
p1 == n2->
p2 )
707 if ( n1->
p1 == n1->
p2 && n2->
p1 == n2->
p2 )
711 close1 = gp1; close2 = gp2;
715 else if ( n1->
p1 == n1->
p2 )
758 LWDEBUGF(4,
"edge_distance_to_edge returned %g", d);
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
double edge_distance_to_edge(const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
Calculate the distance between two edges.
Two-point great circle segment from a to b.
int circ_tree_get_point(const CIRC_NODE *node, POINT2D *pt)
Returns a POINT2D that is a vertex of the input shape.
#define LWDEBUG(level, msg)
static double circ_tree_distance_tree_internal(const CIRC_NODE *n1, const CIRC_NODE *n2, double threshold, double *min_dist, double *max_dist, GEOGRAPHIC_POINT *closest1, GEOGRAPHIC_POINT *closest2)
Point in spherical coordinates on the world.
int circ_tree_contains_point(const CIRC_NODE *node, const POINT2D *pt, const POINT2D *pt_outside, int level, int *on_boundary)
Walk the tree and count intersections between the stab line and the edges.
static int circ_node_is_leaf(const CIRC_NODE *node)
Internal nodes have their point references set to NULL.
static double circ_node_max_distance(const CIRC_NODE *n1, const CIRC_NODE *n2)
double edge_distance_to_point(const GEOGRAPHIC_EDGE *e, const GEOGRAPHIC_POINT *gp, GEOGRAPHIC_POINT *closest)
int lwtype_is_collection(uint8_t type)
Determine whether a type number is a collection or not.
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.
static double circ_node_min_distance(const CIRC_NODE *n1, const CIRC_NODE *n2)
void geographic_point_init(double lon, double lat, GEOGRAPHIC_POINT *g)
Initialize a geographic point.
#define LWDEBUGF(level, msg,...)
int edge_intersection(const GEOGRAPHIC_EDGE *e1, const GEOGRAPHIC_EDGE *e2, GEOGRAPHIC_POINT *g)
Returns true if an intersection can be calculated, and places it in *g.
struct circ_node ** nodes