PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ circ_node_compare()

static int circ_node_compare ( const void *  v1,
const void *  v2 
)
static

Comparing on geohash ensures that nearby nodes will be close to each other in the list.

Definition at line 143 of file lwgeodetic_tree.c.

144{
145 POINT2D p1, p2;
146 unsigned int u1, u2;
147 CIRC_NODE *c1 = *((CIRC_NODE**)v1);
148 CIRC_NODE *c2 = *((CIRC_NODE**)v2);
149 p1.x = rad2deg((c1->center).lon);
150 p1.y = rad2deg((c1->center).lat);
151 p2.x = rad2deg((c2->center).lon);
152 p2.y = rad2deg((c2->center).lat);
153 u1 = geohash_point_as_int(&p1);
154 u2 = geohash_point_as_int(&p2);
155 if ( u1 < u2 ) return -1;
156 if ( u1 > u2 ) return 1;
157 return 0;
158}
unsigned int geohash_point_as_int(POINT2D *pt)
#define rad2deg(r)
Definition lwgeodetic.h:81
double y
Definition liblwgeom.h:376
double x
Definition liblwgeom.h:376
GEOGRAPHIC_POINT center
Note that p1 and p2 are pointers into an independent POINTARRAY, do not free them.

References circ_node::center, geohash_point_as_int(), rad2deg, POINT2D::x, and POINT2D::y.

Referenced by circ_nodes_sort().

Here is the call graph for this function:
Here is the caller graph for this function: