22#include "utils/fmgrprotos.h"
25#define point_point_distance(p1,p2) \
26 DatumGetFloat8(DirectFunctionCall2(point_distance, \
27 PointPGetDatum(p1), PointPGetDatum(p2)))
36 if (isnan(point->
x) || isnan(box->
low.
x) ||
37 isnan(point->
y) || isnan(box->
low.
y))
40 if (point->
x < box->
low.
x)
41 dx = box->
low.
x - point->
x;
42 else if (point->
x > box->
high.
x)
43 dx = point->
x - box->
high.
x;
47 if (point->
y < box->
low.
y)
48 dy = box->
low.
y - point->
y;
49 else if (point->
y > box->
high.
y)
50 dy = point->
y - box->
high.
y;
64 ScanKey orderbys,
int norderbys)
67 double *distances = (
double *)
palloc(norderbys *
sizeof(
double)),
68 *distance = distances;
70 for (sk_num = 0; sk_num < norderbys; ++sk_num, ++orderbys, ++distance)
static float8 get_float8_nan(void)
static Point * DatumGetPointP(Datum X)
static BOX * DatumGetBoxP(Datum X)
BOX * box_copy(BOX *orig)
#define point_point_distance(p1, p2)
double * spg_key_orderbys_distances(Datum key, bool isLeaf, ScanKey orderbys, int norderbys)
static double point_box_distance(Point *point, BOX *box)