1415 static int cluster_size = 100;
1416 static int num_clusters = 4;
1417 static double spread = 1.5;
1418 int N = cluster_size * num_clusters;
1425 for (j = 0; j < num_clusters; j++) {
1426 for (i = 0; i < cluster_size; i++)
1428 double u1 = 1.0 * rand() / RAND_MAX;
1429 double u2 = 1.0 * rand() / RAND_MAX;
1430 double z1 = spread * j + sqrt(-2*log2(u1))*cos(2*M_PI*u2);
1431 double z2 = spread * j + sqrt(-2*log2(u1))*sin(2*M_PI*u2);
1447 for (i = 0; i < k; i++)
LWPOINT * lwpoint_make2d(int srid, double x, double y)
void lwgeom_free(LWGEOM *geom)
LWGEOM * lwpoint_as_lwgeom(const LWPOINT *obj)
void * lwalloc(size_t size)
#define SRID_UNKNOWN
Unknown SRID value.
int * lwgeom_cluster_2d_kmeans(const LWGEOM **geoms, uint32_t ngeoms, uint32_t k)
Take a list of LWGEOMs and a number of clusters and return an integer array indicating which cluster ...