PostGIS  2.5.7dev-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;
44  double d;
49 
50 void circ_tree_print(const CIRC_NODE* node, int depth);
52 void circ_tree_free(CIRC_NODE* node);
53 int circ_tree_contains_point(const CIRC_NODE* node, const POINT2D* pt, const POINT2D* pt_outside, int* on_boundary);
54 double circ_tree_distance_tree(const CIRC_NODE* n1, const CIRC_NODE* n2, const SPHEROID *spheroid, double threshold);
56 int circ_tree_get_point(const CIRC_NODE* node, POINT2D* pt);
57 int circ_tree_get_point_outside(const CIRC_NODE* node, POINT2D* pt);
58 
59 #endif /* _LWGEODETIC_TREE_H */
60 
61 
double circ_tree_distance_tree(const CIRC_NODE *n1, const CIRC_NODE *n2, const SPHEROID *spheroid, double threshold)
CIRC_NODE * circ_tree_new(const POINTARRAY *pa)
Build a tree of nodes from a point array, one node per edge.
int circ_tree_get_point(const CIRC_NODE *node, POINT2D *pt)
Returns a POINT2D that is a vertex of the input shape.
void circ_tree_print(const CIRC_NODE *node, int depth)
void circ_tree_free(CIRC_NODE *node)
Recurse from top of node tree and free all children.
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.
CIRC_NODE * lwgeom_calculate_circ_tree(const LWGEOM *lwgeom)
int circ_tree_get_point_outside(const CIRC_NODE *node, POINT2D *pt)
struct circ_node CIRC_NODE
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
Point in spherical coordinates on the world.
Definition: lwgeodetic.h:53
uint32_t num_nodes
POINT2D * p2
struct circ_node ** nodes
double radius
POINT2D * p1
POINT2D pt_outside
GEOGRAPHIC_POINT center
uint32_t geom_type
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.
unsigned int uint32_t
Definition: uthash.h:78