1329 GISTENTRY *entry = (GISTENTRY *)PG_GETARG_POINTER(0);
1330 StrategyNumber strategy = (StrategyNumber)PG_GETARG_UINT16(2);
1331 char query_box_mem[GIDX_MAX_SIZE];
1332 GIDX *query_box = (GIDX *)query_box_mem;
1334 bool *recheck = (
bool *)PG_GETARG_POINTER(4);
1338 POSTGIS_DEBUG(4,
"[GIST] 'distance' function called");
1342 if (strategy != 13 && strategy != 20)
1344 elog(ERROR,
"unrecognized strategy number: %d", strategy);
1345 PG_RETURN_FLOAT8(FLT_MAX);
1349 if (gserialized_datum_get_gidx_p(PG_GETARG_DATUM(1), query_box) ==
LW_FAILURE)
1351 POSTGIS_DEBUG(4,
"[GIST] null query_gbox_index!");
1352 PG_RETURN_FLOAT8(FLT_MAX);
1356 entry_box = (GIDX *)DatumGetPointer(entry->key);
1362 if (GIST_LEAF(entry))
static double gidx_distance(const GIDX *a, const GIDX *b, int m_is_time)
Calculate the box->box distance.
static double distance(double x1, double y1, double x2, double y2)