389 .num_items_found = 0,
390 .items_found_size = 0
397 in_a_cluster =
lwalloc(num_geoms *
sizeof(
char));
398 memset(in_a_cluster, 0, num_geoms *
sizeof(
char));
400 if (in_a_cluster_ret)
401 *in_a_cluster_ret = in_a_cluster;
404 if (num_geoms <= min_points)
406 if (!in_a_cluster_ret)
412 if (tree.tree == NULL)
418 is_in_core =
lwalloc(num_geoms *
sizeof(
char));
419 memset(is_in_core, 0, num_geoms *
sizeof(
char));
422 for (p = 0; p < num_geoms; p++)
439 if (num_neighbors >= min_points)
451 if (in_a_cluster[q] && !is_in_core[q])
456 if (mindist == FLT_MAX)
467 if (num_neighbors < min_points)
469 neighbors[num_neighbors++] = q;
474 if (num_neighbors == min_points)
479 for (j = 0; j < num_neighbors; j++)
504 if (!in_a_cluster_ret)
double lwgeom_mindistance2d_tolerance(const LWGEOM *lw1, const LWGEOM *lw2, double tolerance)
Function handling min distance calculations and dwithin calculations.
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members)
void * lwalloc(size_t size)
#define LW_TRUE
Return types for functions with status returns.
static int dbscan_update_context(GEOSSTRtree *tree, struct QueryContext *cxt, LWGEOM **geoms, uint32_t p, double eps)
static struct STRTree make_strtree(void **geoms, uint32_t num_geoms, char is_lwgeom)
Make a GEOSSTRtree that stores a pointer to a variable containing the array index of the input geoms.
static void destroy_strtree(struct STRTree *tree)
Clean up STRTree after use.
static void union_if_available(UNIONFIND *uf, uint32_t p, uint32_t q, char *is_in_core, char *in_a_cluster)
uint32_t UF_find(UNIONFIND *uf, uint32_t i)