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

◆ circ_internal_nodes_sort()

static void circ_internal_nodes_sort ( CIRC_NODE **  nodes,
uint32_t  num_nodes,
const CIRC_NODE target_node 
)
static

Definition at line 653 of file lwgeodetic_tree.c.

654{
655 uint32_t i;
657
658 /* Copy incoming nodes into sorting array and calculate */
659 /* distance to the target node */
660 for (i = 0; i < num_nodes; i++)
661 {
662 sort_nodes[i].node = nodes[i];
663 sort_nodes[i].d = sphere_distance(&(nodes[i]->center), &(target_node->center));
664 }
665
666 /* Sort the nodes and copy the result back into the input array */
667 qsort(sort_nodes, num_nodes, sizeof(struct sort_node), circ_nodes_sort_cmp);
668 for (i = 0; i < num_nodes; i++)
669 {
670 nodes[i] = sort_nodes[i].node;
671 }
672 return;
673}
double sphere_distance(const GEOGRAPHIC_POINT *s, const GEOGRAPHIC_POINT *e)
Given two points on a unit sphere, calculate their distance apart in radians.
Definition lwgeodetic.c:948
static int circ_nodes_sort_cmp(const void *a, const void *b)
#define CIRC_NODE_SIZE
CIRC_NODE * node

References CIRC_NODE_SIZE, circ_nodes_sort_cmp(), sort_node::d, circ_node::d, sort_node::node, and sphere_distance().

Referenced by circ_tree_distance_tree_internal().

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