PostGIS  2.5.0dev-r@@SVN_REVISION@@
lwgeodetic_tree.h
Go to the documentation of this file.
1 /**********************************************************************
2  *
3  * PostGIS - Spatial Types for PostgreSQL
4  * http://postgis.net
5  *
6  * PostGIS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * PostGIS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with PostGIS. If not, see <http://www.gnu.org/licenses/>.
18  *
19  **********************************************************************
20  *
21  * Copyright (C) 2012-2015 Paul Ramsey <pramsey@cleverelephant.ca>
22  *
23  **********************************************************************/
24 
25 
26 #ifndef _LWGEODETIC_TREE_H
27 #define _LWGEODETIC_TREE_H 1
28 
29 #include "lwgeodetic.h"
30 
31 #define CIRC_NODE_SIZE 8
32 
36 typedef struct circ_node
37 {
39  double radius;
41  struct circ_node** nodes;
42  int edge_num;
47 } CIRC_NODE;
48 
49 void circ_tree_print(const CIRC_NODE* node, int depth);
51 void circ_tree_free(CIRC_NODE* node);
52 int circ_tree_contains_point(const CIRC_NODE* node, const POINT2D* pt, const POINT2D* pt_outside, int* on_boundary);
53 double circ_tree_distance_tree(const CIRC_NODE* n1, const CIRC_NODE* n2, const SPHEROID *spheroid, double threshold);
55 int circ_tree_get_point(const CIRC_NODE* node, POINT2D* pt);
56 
57 #endif /* _LWGEODETIC_TREE_H */
58 
59 
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
GEOGRAPHIC_POINT center
uint32_t num_nodes
uint32_t geom_type
int circ_tree_get_point(const CIRC_NODE *node, POINT2D *pt)
Returns a POINT2D that is a vertex of the input shape.
POINT2D * p2
POINT2D * p1
double circ_tree_distance_tree(const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:47
unsigned int uint32_t
Definition: uthash.h:78
CIRC_NODE * circ_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge.
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 circ_tree_print(const CIRC_NODE *node, int depth)
struct circ_node CIRC_NODE
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
POINT2D pt_outside
double radius
struct circ_node ** nodes