385 .num_items_found = 0,
386 .items_found_size = 0
393 in_a_cluster =
lwalloc(num_geoms *
sizeof(
char));
394 memset(in_a_cluster, 0, num_geoms *
sizeof(
char));
396 if (in_a_cluster_ret)
397 *in_a_cluster_ret = in_a_cluster;
400 if (num_geoms <= min_points)
402 if (!in_a_cluster_ret)
408 if (tree.tree == NULL)
414 is_in_core =
lwalloc(num_geoms *
sizeof(
char));
415 memset(is_in_core, 0, num_geoms *
sizeof(
char));
418 for (p = 0; p < num_geoms; p++)
435 if (num_neighbors >= min_points)
447 if (in_a_cluster[q] && !is_in_core[q])
452 if (mindist == FLT_MAX)
463 if (num_neighbors < min_points)
465 neighbors[num_neighbors++] = q;
470 if (num_neighbors == min_points)
475 for (j = 0; j < num_neighbors; j++)
500 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.
uint32_t UF_find(UNIONFIND *uf, uint32_t i)
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...
#define LW_TRUE
Return types for functions with status returns.
static void union_if_available(UNIONFIND *uf, uint32_t p, uint32_t q, char *is_in_core, char *in_a_cluster)
static void destroy_strtree(struct STRTree *tree)
Clean up STRTree after use.
static int dbscan_update_context(GEOSSTRtree *tree, struct QueryContext *cxt, LWGEOM **geoms, uint32_t p, double eps)
void * lwalloc(size_t size)
int lwgeom_is_empty(const LWGEOM *geom)
Return true or false depending on whether a geometry is an "empty" geometry (no vertices members) ...