1315 GISTENTRY *origentry = (GISTENTRY*) PG_GETARG_POINTER(0);
1316 GISTENTRY *newentry = (GISTENTRY*) PG_GETARG_POINTER(1);
1317 float *result = (
float*) PG_GETARG_POINTER(2);
1318 BOX2DF *gbox_index_orig, *gbox_index_new;
1319 float size_union, size_orig, edge_union, edge_orig;
1321 POSTGIS_DEBUG(4,
"[GIST] 'penalty' function called");
1323 gbox_index_orig = (BOX2DF*)DatumGetPointer(origentry->key);
1324 gbox_index_new = (BOX2DF*)DatumGetPointer(newentry->key);
1327 if ( (gbox_index_orig == NULL) && (gbox_index_new == NULL) )
1329 POSTGIS_DEBUG(4,
"[GIST] both inputs NULL! returning penalty of zero");
1331 PG_RETURN_FLOAT8(*result);
1337 *result = size_union - size_orig;
1354 *result = edge_union - edge_orig;
1370 POSTGIS_DEBUGF(4,
"[GIST] 'penalty', union size (%.12f), original size (%.12f), penalty (%.12f)", size_union, size_orig, *result);
1372 PG_RETURN_POINTER(result);
static float box2df_union_edge(const BOX2DF *a, const BOX2DF *b)
static float box2df_size(const BOX2DF *a)
static float pack_float(const float value, const int realm)
static float box2df_union_size(const BOX2DF *a, const BOX2DF *b)
static float box2df_edge(const BOX2DF *a)