1379 GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1380 GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1381 float *result = (
float*) PG_GETARG_POINTER(2);
1382 BOX2DF *gbox_index_orig, *gbox_index_new;
1383 float size_union, size_orig, edge_union, edge_orig;
1385 POSTGIS_DEBUG(4,
"[GIST] 'penalty' function called");
1387 gbox_index_orig = (BOX2DF*)DatumGetPointer(origentry->key);
1388 gbox_index_new = (BOX2DF*)DatumGetPointer(newentry->key);
1391 if ( (gbox_index_orig == NULL) && (gbox_index_new == NULL) )
1393 POSTGIS_DEBUG(4,
"[GIST] both inputs NULL! returning penalty of zero");
1395 PG_RETURN_FLOAT8(*result);
1401 *result = size_union - size_orig;
1418 *result = edge_union - edge_orig;
1434 POSTGIS_DEBUGF(4,
"[GIST] 'penalty', union size (%.12f), original size (%.12f), penalty (%.12f)", size_union, size_orig, *result);
1436 PG_RETURN_POINTER(result);
static float box2df_size(const BOX2DF *a)
static float box2df_union_size(const BOX2DF *a, const BOX2DF *b)
static float pack_float(const float value, const int realm)
static float box2df_union_edge(const BOX2DF *a, const BOX2DF *b)
static float box2df_edge(const BOX2DF *a)