PostGIS  2.3.7dev-r@@SVN_REVISION@@
static int lwkmeans_pt_closest ( const Pointer objs,
size_t  num_objs,
const Pointer  a 
)
static

Definition at line 19 of file lwkmeans.c.

References lwkmeans_pt_distance().

Referenced by lwgeom_cluster_2d_kmeans().

20 {
21  int i;
22  double d;
23  double d_closest = FLT_MAX;
24  int closest = -1;
25 
26  assert(num_objs > 0);
27 
28  for (i = 0; i < num_objs; i++)
29  {
30  /* Skip nulls/empties */
31  if (!objs[i])
32  continue;
33 
34  d = lwkmeans_pt_distance(objs[i], a);
35  if (d < d_closest)
36  {
37  d_closest = d;
38  closest = i;
39  }
40  }
41 
42  return closest;
43 }
static double lwkmeans_pt_distance(const Pointer a, const Pointer b)
Definition: lwkmeans.c:8

Here is the call graph for this function:

Here is the caller graph for this function: