PostGIS 3.7.0dev-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 142 of file lwgeodetic_tree.c.

143{
144 POINT2D p1, p2;
145 unsigned int u1, u2;
146 CIRC_NODE *c1 = *((CIRC_NODE**)v1);
147 CIRC_NODE *c2 = *((CIRC_NODE**)v2);
148 p1.x = rad2deg((c1->center).lon);
149 p1.y = rad2deg((c1->center).lat);
150 p2.x = rad2deg((c2->center).lon);
151 p2.y = rad2deg((c2->center).lat);
152 u1 = geohash_point_as_int(&p1);
153 u2 = geohash_point_as_int(&p2);
154 if ( u1 < u2 ) return -1;
155 if ( u1 > u2 ) return 1;
156 return 0;
157}
unsigned int geohash_point_as_int(POINT2D *pt)
#define rad2deg(r)
Definition lwgeodetic.h:81
double y
Definition liblwgeom.h:390
double x
Definition liblwgeom.h:390
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: