PostGIS  2.5.0dev-r@@SVN_REVISION@@
lwgeodetic_tree.c File Reference
#include "liblwgeom_internal.h"
#include "lwgeodetic_tree.h"
#include "lwgeom_log.h"
Include dependency graph for lwgeodetic_tree.c:

Go to the source code of this file.

Data Structures

struct  sort_node
 

Functions

static CIRC_NODEcirc_nodes_merge (CIRC_NODE **nodes, int num_nodes)
 
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)
 
static int circ_node_is_leaf (const CIRC_NODE *node)
 Internal nodes have their point references set to NULL. More...
 
void circ_tree_free (CIRC_NODE *node)
 Recurse from top of node tree and free all children. More...
 
static CIRC_NODEcirc_node_leaf_new (const POINTARRAY *pa, int i)
 Create a new leaf node, storing pointers back to the end points for later. More...
 
static CIRC_NODEcirc_node_leaf_point_new (const POINTARRAY *pa)
 Return a point node (zero radius, referencing one point) More...
 
static int circ_node_compare (const void *v1, const void *v2)
 Comparing on geohash ensures that nearby nodes will be close to each other in the list. More...
 
static int circ_center_spherical (const GEOGRAPHIC_POINT *c1, const GEOGRAPHIC_POINT *c2, double distance, double offset, GEOGRAPHIC_POINT *center)
 Given the centers of two circles, and the offset distance we want to put the new center between them (calculated as the distance implied by the radii of the inputs and the distance between the centers) figure out where the new center point is, by getting the direction from c1 to c2 and projecting from c1 in that direction by the offset distance. More...
 
static int circ_center_cartesian (const GEOGRAPHIC_POINT *c1, const GEOGRAPHIC_POINT *c2, double distance, double offset, GEOGRAPHIC_POINT *center)
 Where the circ_center_spherical() function fails, we need a fall-back. More...
 
static CIRC_NODEcirc_node_internal_new (CIRC_NODE **c, uint32_t num_nodes)
 Create a new internal node, calculating the new measure range for the node, and storing pointers to the child nodes. More...
 
CIRC_NODEcirc_tree_new (const POINTARRAY *pa)
 Build a tree of nodes from a point array, one node per edge. More...
 
static void circ_nodes_sort (CIRC_NODE **nodes, int num_nodes)
 Given a list of nodes, sort them into a spatially consistent order, then pairwise merge them up into a tree. More...
 
int circ_tree_get_point (const CIRC_NODE *node, POINT2D *pt)
 Returns a POINT2D that is a vertex of the input shape. More...
 
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. More...
 
static double circ_node_min_distance (const CIRC_NODE *n1, const CIRC_NODE *n2)
 
static double circ_node_max_distance (const CIRC_NODE *n1, const CIRC_NODE *n2)
 
double circ_tree_distance_tree (const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
 
static int circ_nodes_sort_cmp (const void *a, const void *b)
 
static void circ_internal_nodes_sort (CIRC_NODE **nodes, uint32_t num_nodes, const CIRC_NODE *target_node)
 
void circ_tree_print (const CIRC_NODE *node, int depth)
 
static CIRC_NODElwpoint_calculate_circ_tree (const LWPOINT *lwpoint)
 
static CIRC_NODElwline_calculate_circ_tree (const LWLINE *lwline)
 
static CIRC_NODElwpoly_calculate_circ_tree (const LWPOLY *lwpoly)
 
static CIRC_NODElwcollection_calculate_circ_tree (const LWCOLLECTION *lwcol)
 
CIRC_NODElwgeom_calculate_circ_tree (const LWGEOM *lwgeom)