Convert all remaining geometric operators to new fmgr style. This

allows fixing problems with operators that expected to be able to
return a NULL, such as the '#' line-segment-intersection operator
that tried to return NULL when the two segments don't intersect.
(See, eg, bug report from 1-Nov-99 on pghackers.)  Fix some other
bugs in passing, such as backwards comparison in path_distance().
This commit is contained in:
Tom Lane 2000-07-30 20:44:02 +00:00
parent d70d46fd60
commit 3a9a74a09d
8 changed files with 1755 additions and 1592 deletions

View File

@ -3,12 +3,19 @@
* rtproc.c
* pg_amproc entries for rtrees.
*
* NOTE: for largely-historical reasons, the intersection functions should
* return a NULL pointer (*not* an SQL null value) to indicate "no
* intersection". The size functions must be prepared to accept such
* a pointer and return 0. This convention means that only pass-by-reference
* data types can be used as the output of the union and intersection
* routines, but that's not a big problem.
*
*
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.28 2000/07/29 18:45:52 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtproc.c,v 1.29 2000/07/30 20:43:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -18,29 +25,31 @@
#include "utils/geo_decls.h"
BOX *
rt_box_union(BOX *a, BOX *b)
Datum
rt_box_union(PG_FUNCTION_ARGS)
{
BOX *a = PG_GETARG_BOX_P(0);
BOX *b = PG_GETARG_BOX_P(1);
BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(ERROR, "Cannot allocate box for union");
n = (BOX *) palloc(sizeof(BOX));
n->high.x = Max(a->high.x, b->high.x);
n->high.y = Max(a->high.y, b->high.y);
n->low.x = Min(a->low.x, b->low.x);
n->low.y = Min(a->low.y, b->low.y);
return n;
PG_RETURN_BOX_P(n);
}
BOX *
rt_box_inter(BOX *a, BOX *b)
Datum
rt_box_inter(PG_FUNCTION_ARGS)
{
BOX *a = PG_GETARG_BOX_P(0);
BOX *b = PG_GETARG_BOX_P(1);
BOX *n;
if ((n = (BOX *) palloc(sizeof(*n))) == (BOX *) NULL)
elog(ERROR, "Cannot allocate box for union");
n = (BOX *) palloc(sizeof(BOX));
n->high.x = Min(a->high.x, b->high.x);
n->high.y = Min(a->high.y, b->high.y);
@ -50,21 +59,26 @@ rt_box_inter(BOX *a, BOX *b)
if (n->high.x < n->low.x || n->high.y < n->low.y)
{
pfree(n);
return (BOX *) NULL;
/* Indicate "no intersection" by returning NULL pointer */
n = NULL;
}
return n;
PG_RETURN_BOX_P(n);
}
void
rt_box_size(BOX *a, float *size)
Datum
rt_box_size(PG_FUNCTION_ARGS)
{
BOX *a = PG_GETARG_BOX_P(0);
/* NB: size is an output argument */
float *size = (float *) PG_GETARG_POINTER(1);
if (a == (BOX *) NULL || a->high.x <= a->low.x || a->high.y <= a->low.y)
*size = 0.0;
else
*size = (float) ((a->high.x - a->low.x) * (a->high.y - a->low.y));
return;
PG_RETURN_VOID();
}
/*
@ -75,10 +89,10 @@ rt_box_size(BOX *a, float *size)
* as the return type for the size routine, so we no longer need to
* have a special return type for big boxes.
*/
void
rt_bigbox_size(BOX *a, float *size)
Datum
rt_bigbox_size(PG_FUNCTION_ARGS)
{
rt_box_size(a, size);
return rt_box_size(fcinfo);
}
Datum
@ -105,30 +119,6 @@ rt_poly_union(PG_FUNCTION_ARGS)
PG_RETURN_POLYGON_P(p);
}
Datum
rt_poly_size(PG_FUNCTION_ARGS)
{
POLYGON *a = PG_GETARG_POLYGON_P(0);
/* NB: size is an output argument */
float *size = (float *) PG_GETARG_POINTER(1);
double xdim,
ydim;
if (a == (POLYGON *) NULL ||
a->boundbox.high.x <= a->boundbox.low.x ||
a->boundbox.high.y <= a->boundbox.low.y)
*size = 0.0;
else
{
xdim = (a->boundbox.high.x - a->boundbox.low.x);
ydim = (a->boundbox.high.y - a->boundbox.low.y);
*size = (float) (xdim * ydim);
}
PG_RETURN_VOID();
}
Datum
rt_poly_inter(PG_FUNCTION_ARGS)
{
@ -146,16 +136,52 @@ rt_poly_inter(PG_FUNCTION_ARGS)
p->boundbox.low.x = Max(a->boundbox.low.x, b->boundbox.low.x);
p->boundbox.low.y = Max(a->boundbox.low.y, b->boundbox.low.y);
/* Avoid leaking memory when handed toasted input. */
PG_FREE_IF_COPY(a, 0);
PG_FREE_IF_COPY(b, 1);
if (p->boundbox.high.x < p->boundbox.low.x ||
p->boundbox.high.y < p->boundbox.low.y)
{
pfree(p);
PG_RETURN_NULL();
/* Indicate "no intersection" by returning NULL pointer */
p = NULL;
}
/* Avoid leaking memory when handed toasted input. */
PG_FREE_IF_COPY(a, 0);
PG_FREE_IF_COPY(b, 1);
PG_RETURN_POLYGON_P(p);
}
Datum
rt_poly_size(PG_FUNCTION_ARGS)
{
Pointer aptr = PG_GETARG_POINTER(0);
/* NB: size is an output argument */
float *size = (float *) PG_GETARG_POINTER(1);
POLYGON *a;
double xdim,
ydim;
/* Can't just use GETARG because of possibility that input is NULL;
* since POLYGON is toastable, GETARG will try to inspect its value
*/
if (aptr == NULL)
{
*size = 0.0;
PG_RETURN_VOID();
}
/* Now safe to apply GETARG */
a = PG_GETARG_POLYGON_P(0);
if (a->boundbox.high.x <= a->boundbox.low.x ||
a->boundbox.high.y <= a->boundbox.low.y)
*size = 0.0;
else
{
xdim = (a->boundbox.high.x - a->boundbox.low.x);
ydim = (a->boundbox.high.y - a->boundbox.low.y);
*size = (float) (xdim * ydim);
}
PG_RETURN_VOID();
}

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.52 2000/07/14 22:17:36 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.53 2000/07/30 20:43:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -745,13 +745,16 @@ picksplit(Relation r,
DatumGetPointer(FunctionCall2(&rtstate->interFn,
PointerGetDatum(datum_alpha),
PointerGetDatum(datum_beta)));
/* The interFn may return a NULL pointer (not an SQL null!)
* to indicate no intersection. sizeFn must cope with this.
*/
FunctionCall2(&rtstate->sizeFn,
PointerGetDatum(inter_d),
PointerGetDatum(&size_inter));
size_waste = size_union - size_inter;
pfree(union_d);
if (union_d != (char *) NULL)
pfree(union_d);
if (inter_d != (char *) NULL)
pfree(inter_d);
@ -1051,7 +1054,8 @@ _rtdump(Relation r)
itoffno = ItemPointerGetOffsetNumber(&(itup->t_tid));
datum = ((char *) itup);
datum += sizeof(IndexTupleData);
itkey = (char *) box_out((BOX *) datum);
itkey = DatumGetCString(DirectFunctionCall1(box_out,
PointerGetDatum(datum)));
printf("\t[%d] size %d heap <%d,%d> key:%s\n",
offnum, IndexTupleSize(itup), itblkno, itoffno, itkey);
pfree(itkey);

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: pg_proc.h,v 1.151 2000/07/29 18:45:57 tgl Exp $
* $Id: pg_proc.h,v 1.152 2000/07/30 20:43:44 tgl Exp $
*
* NOTES
* The script catalog/genbki.sh reads this file and generates .bki
@ -243,54 +243,54 @@ DESCR("convert int2 to text");
DATA(insert OID = 114 ( text PGUID 12 f t t t 1 f 25 "26" 100 0 0 100 oid_text - ));
DESCR("convert oid to text");
DATA(insert OID = 115 ( box_above PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_above - ));
DATA(insert OID = 115 ( box_above PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_above - ));
DESCR("is above");
DATA(insert OID = 116 ( box_below PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_below - ));
DATA(insert OID = 116 ( box_below PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_below - ));
DESCR("is below");
DATA(insert OID = 117 ( point_in PGUID 11 f t t t 1 f 600 "0" 100 0 0 100 point_in - ));
DATA(insert OID = 117 ( point_in PGUID 12 f t t t 1 f 600 "0" 100 0 0 100 point_in - ));
DESCR("(internal)");
DATA(insert OID = 118 ( point_out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 point_out - ));
DATA(insert OID = 118 ( point_out PGUID 12 f t t t 1 f 23 "600" 100 0 0 100 point_out - ));
DESCR("(internal)");
DATA(insert OID = 119 ( lseg_in PGUID 11 f t t t 1 f 601 "0" 100 0 0 100 lseg_in - ));
DATA(insert OID = 119 ( lseg_in PGUID 12 f t t t 1 f 601 "0" 100 0 0 100 lseg_in - ));
DESCR("(internal)");
DATA(insert OID = 120 ( lseg_out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 lseg_out - ));
DATA(insert OID = 120 ( lseg_out PGUID 12 f t t t 1 f 23 "0" 100 0 0 100 lseg_out - ));
DESCR("(internal)");
DATA(insert OID = 121 ( path_in PGUID 12 f t t t 1 f 602 "0" 100 0 0 100 path_in - ));
DESCR("(internal)");
DATA(insert OID = 122 ( path_out PGUID 12 f t t t 1 f 23 "0" 100 0 0 100 path_out - ));
DESCR("(internal)");
DATA(insert OID = 123 ( box_in PGUID 11 f t t t 1 f 603 "0" 100 0 0 100 box_in - ));
DATA(insert OID = 123 ( box_in PGUID 12 f t t t 1 f 603 "0" 100 0 0 100 box_in - ));
DESCR("(internal)");
DATA(insert OID = 124 ( box_out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 box_out - ));
DATA(insert OID = 124 ( box_out PGUID 12 f t t t 1 f 23 "0" 100 0 0 100 box_out - ));
DESCR("(internal)");
DATA(insert OID = 125 ( box_overlap PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_overlap - ));
DATA(insert OID = 125 ( box_overlap PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_overlap - ));
DESCR("overlaps");
DATA(insert OID = 126 ( box_ge PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_ge - ));
DESCR("greater-than-or-equal");
DATA(insert OID = 127 ( box_gt PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_gt - ));
DESCR("greater-than");
DATA(insert OID = 128 ( box_eq PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_eq - ));
DESCR("equal");
DATA(insert OID = 129 ( box_lt PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_lt - ));
DESCR("less-than");
DATA(insert OID = 130 ( box_le PGUID 11 f t t t 2 f 16 "603 603" 100 1 0 100 box_le - ));
DESCR("less-than-or-equal");
DATA(insert OID = 131 ( point_above PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_above - ));
DATA(insert OID = 126 ( box_ge PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_ge - ));
DESCR("greater-than-or-equal by area");
DATA(insert OID = 127 ( box_gt PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_gt - ));
DESCR("greater-than by area");
DATA(insert OID = 128 ( box_eq PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_eq - ));
DESCR("equal by area");
DATA(insert OID = 129 ( box_lt PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_lt - ));
DESCR("less-than by area");
DATA(insert OID = 130 ( box_le PGUID 12 f t t t 2 f 16 "603 603" 100 1 0 100 box_le - ));
DESCR("less-than-or-equal by area");
DATA(insert OID = 131 ( point_above PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_above - ));
DESCR("is above");
DATA(insert OID = 132 ( point_left PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_left - ));
DATA(insert OID = 132 ( point_left PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_left - ));
DESCR("is left of");
DATA(insert OID = 133 ( point_right PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_right - ));
DESCR("is left of");
DATA(insert OID = 134 ( point_below PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_below - ));
DATA(insert OID = 133 ( point_right PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_right - ));
DESCR("is right of");
DATA(insert OID = 134 ( point_below PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_below - ));
DESCR("is below");
DATA(insert OID = 135 ( point_eq PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_eq - ));
DATA(insert OID = 135 ( point_eq PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_eq - ));
DESCR("same as");
DATA(insert OID = 136 ( on_pb PGUID 11 f t t t 2 f 16 "600 603" 100 0 0 100 on_pb - ));
DATA(insert OID = 136 ( on_pb PGUID 12 f t t t 2 f 16 "600 603" 100 0 0 100 on_pb - ));
DESCR("point is inside");
DATA(insert OID = 137 ( on_ppath PGUID 12 f t t t 2 f 16 "600 602" 100 0 1 0 on_ppath - ));
DESCR("contained in");
DATA(insert OID = 138 ( box_center PGUID 11 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DATA(insert OID = 138 ( box_center PGUID 12 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DESCR("center of");
DATA(insert OID = 139 ( areasel PGUID 12 f t f t 5 f 701 "26 26 21 0 23" 100 0 0 100 areasel - ));
DESCR("restriction selectivity for area-comparison operators");
@ -300,8 +300,6 @@ DATA(insert OID = 141 ( int4mul PGUID 12 f t t t 2 f 23 "23 23" 100 0 0 100
DESCR("multiply");
DATA(insert OID = 142 ( int4fac PGUID 12 f t t t 1 f 23 "23" 100 0 0 100 int4fac - ));
DESCR("factorial");
DATA(insert OID = 143 ( pointdist PGUID 11 f t t t 2 f 23 "600 600" 100 0 0 100 pointdist - ));
DESCR("");
DATA(insert OID = 144 ( int4ne PGUID 12 f t t t 2 f 16 "23 23" 100 0 0 100 int4ne - ));
DESCR("not equal");
DATA(insert OID = 145 ( int2ne PGUID 12 f t t t 2 f 16 "21 21" 100 0 0 100 int2ne - ));
@ -386,27 +384,27 @@ DATA(insert OID = 184 ( oideq PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100
DESCR("equal");
DATA(insert OID = 185 ( oidne PGUID 12 f t t t 2 f 16 "26 26" 100 0 0 100 oidne - ));
DESCR("not equal");
DATA(insert OID = 186 ( box_same PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_same - ));
DATA(insert OID = 186 ( box_same PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_same - ));
DESCR("same as");
DATA(insert OID = 187 ( box_contain PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_contain - ));
DATA(insert OID = 187 ( box_contain PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_contain - ));
DESCR("contains");
DATA(insert OID = 188 ( box_left PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_left - ));
DATA(insert OID = 188 ( box_left PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_left - ));
DESCR("is left of");
DATA(insert OID = 189 ( box_overleft PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_overleft - ));
DATA(insert OID = 189 ( box_overleft PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_overleft - ));
DESCR("overlaps, but does not extend to right of");
DATA(insert OID = 190 ( box_overright PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_overright - ));
DATA(insert OID = 190 ( box_overright PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_overright - ));
DESCR("overlaps, but does not extend to left of");
DATA(insert OID = 191 ( box_right PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_right - ));
DESCR("is left of");
DATA(insert OID = 192 ( box_contained PGUID 11 f t t t 2 f 16 "603 603" 100 0 0 100 box_contained - ));
DATA(insert OID = 191 ( box_right PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_right - ));
DESCR("is right of");
DATA(insert OID = 192 ( box_contained PGUID 12 f t t t 2 f 16 "603 603" 100 0 0 100 box_contained - ));
DESCR("contained in");
DATA(insert OID = 193 ( rt_box_union PGUID 11 f t t t 2 f 603 "603 603" 100 0 0 100 rt_box_union - ));
DATA(insert OID = 193 ( rt_box_union PGUID 12 f t t t 2 f 603 "603 603" 100 0 0 100 rt_box_union - ));
DESCR("r-tree");
DATA(insert OID = 194 ( rt_box_inter PGUID 11 f t t t 2 f 603 "603 603" 100 0 0 100 rt_box_inter - ));
DATA(insert OID = 194 ( rt_box_inter PGUID 12 f t t t 2 f 603 "603 603" 100 0 0 100 rt_box_inter - ));
DESCR("r-tree");
DATA(insert OID = 195 ( rt_box_size PGUID 11 f t t t 2 f 700 "603 700" 100 0 0 100 rt_box_size - ));
DATA(insert OID = 195 ( rt_box_size PGUID 12 f t t t 2 f 700 "603 700" 100 0 0 100 rt_box_size - ));
DESCR("r-tree");
DATA(insert OID = 196 ( rt_bigbox_size PGUID 11 f t t t 2 f 700 "603 700" 100 0 0 100 rt_bigbox_size - ));
DATA(insert OID = 196 ( rt_bigbox_size PGUID 12 f t t t 2 f 700 "603 700" 100 0 0 100 rt_bigbox_size - ));
DESCR("r-tree");
DATA(insert OID = 197 ( rt_poly_union PGUID 12 f t t t 2 f 604 "604 604" 100 0 0 100 rt_poly_union - ));
DESCR("r-tree");
@ -468,7 +466,7 @@ DESCR("larger of two");
DATA(insert OID = 224 ( float8smaller PGUID 11 f t t t 2 f 701 "701 701" 100 0 0 100 float8smaller - ));
DESCR("smaller of two");
DATA(insert OID = 225 ( lseg_center PGUID 11 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - ));
DATA(insert OID = 225 ( lseg_center PGUID 12 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - ));
DESCR("center of");
DATA(insert OID = 226 ( path_center PGUID 12 f t t t 1 f 600 "602" 100 0 0 100 path_center - ));
DESCR("center of");
@ -497,7 +495,7 @@ DATA(insert OID = 237 ( int2 PGUID 12 f t t t 1 f 21 "701" 100 0 0 100 d
DESCR("convert float8 to int2");
DATA(insert OID = 238 ( int2 PGUID 12 f t t t 1 f 21 "700" 100 0 0 100 ftoi2 - ));
DESCR("convert float4 to int2");
DATA(insert OID = 239 ( line_distance PGUID 11 f t t t 2 f 701 "628 628" 100 0 0 100 line_distance - ));
DATA(insert OID = 239 ( line_distance PGUID 12 f t t t 2 f 701 "628 628" 100 0 0 100 line_distance - ));
DESCR("distance between");
DATA(insert OID = 240 ( nabstimein PGUID 12 f t f t 1 f 702 "0" 100 0 0 100 nabstimein - ));
@ -576,9 +574,9 @@ DESCR("");
DATA(insert OID = 276 ( int2fac PGUID 12 f t t t 1 f 23 "21" 100 0 0 100 int2fac - ));
DESCR("");
DATA(insert OID = 277 ( inter_sl PGUID 11 f t t t 2 f 16 "601 628" 100 0 0 100 inter_sl - ));
DATA(insert OID = 277 ( inter_sl PGUID 12 f t t t 2 f 16 "601 628" 100 0 0 100 inter_sl - ));
DESCR("");
DATA(insert OID = 278 ( inter_lb PGUID 11 f t t t 2 f 16 "628 603" 100 0 0 100 inter_lb - ));
DATA(insert OID = 278 ( inter_lb PGUID 12 f t t t 2 f 16 "628 603" 100 0 0 100 inter_lb - ));
DESCR("");
DATA(insert OID = 279 ( float48mul PGUID 11 f t t t 2 f 701 "700 701" 100 0 0 100 float48mul - ));
@ -753,31 +751,31 @@ DESCR("btree less-equal-greater");
DATA(insert OID = 360 ( bttextcmp PGUID 12 f t t t 2 f 23 "25 25" 100 0 0 100 bttextcmp - ));
DESCR("btree less-equal-greater");
DATA(insert OID = 361 ( lseg_distance PGUID 11 f t t t 2 f 701 "601 601" 100 0 0 100 lseg_distance - ));
DATA(insert OID = 361 ( lseg_distance PGUID 12 f t t t 2 f 701 "601 601" 100 0 0 100 lseg_distance - ));
DESCR("distance between");
DATA(insert OID = 362 ( lseg_interpt PGUID 11 f t t t 2 f 600 "601 601" 100 0 0 100 lseg_interpt - ));
DATA(insert OID = 362 ( lseg_interpt PGUID 12 f t t t 2 f 600 "601 601" 100 0 0 100 lseg_interpt - ));
DESCR("");
DATA(insert OID = 363 ( dist_ps PGUID 11 f t t t 2 f 701 "600 601" 100 0 0 100 dist_ps - ));
DATA(insert OID = 363 ( dist_ps PGUID 12 f t t t 2 f 701 "600 601" 100 0 0 100 dist_ps - ));
DESCR("distance between");
DATA(insert OID = 364 ( dist_pb PGUID 11 f t t t 2 f 701 "600 603" 100 0 0 100 dist_pb - ));
DATA(insert OID = 364 ( dist_pb PGUID 12 f t t t 2 f 701 "600 603" 100 0 0 100 dist_pb - ));
DESCR("distance between point and box");
DATA(insert OID = 365 ( dist_sb PGUID 11 f t t t 2 f 701 "601 603" 100 0 0 100 dist_sb - ));
DATA(insert OID = 365 ( dist_sb PGUID 12 f t t t 2 f 701 "601 603" 100 0 0 100 dist_sb - ));
DESCR("distance between segment and box");
DATA(insert OID = 366 ( close_ps PGUID 11 f t t t 2 f 600 "600 601" 100 0 0 100 close_ps - ));
DATA(insert OID = 366 ( close_ps PGUID 12 f t t t 2 f 600 "600 601" 100 0 0 100 close_ps - ));
DESCR("closest point on line segment");
DATA(insert OID = 367 ( close_pb PGUID 11 f t t t 2 f 600 "600 603" 100 0 0 100 close_pb - ));
DATA(insert OID = 367 ( close_pb PGUID 12 f t t t 2 f 600 "600 603" 100 0 0 100 close_pb - ));
DESCR("closest point on box");
DATA(insert OID = 368 ( close_sb PGUID 11 f t t t 2 f 600 "601 603" 100 0 0 100 close_sb - ));
DATA(insert OID = 368 ( close_sb PGUID 12 f t t t 2 f 600 "601 603" 100 0 0 100 close_sb - ));
DESCR("closest point to line segment on box");
DATA(insert OID = 369 ( on_ps PGUID 11 f t t t 2 f 16 "600 601" 100 0 0 100 on_ps - ));
DATA(insert OID = 369 ( on_ps PGUID 12 f t t t 2 f 16 "600 601" 100 0 0 100 on_ps - ));
DESCR("point contained in segment");
DATA(insert OID = 370 ( path_distance PGUID 12 f t t t 2 f 701 "602 602" 100 0 1 0 path_distance - ));
DESCR("distance between paths");
DATA(insert OID = 371 ( dist_ppath PGUID 12 f t t t 2 f 701 "600 602" 100 0 1 0 dist_ppath - ));
DESCR("distance between point and path");
DATA(insert OID = 372 ( on_sb PGUID 11 f t t t 2 f 16 "601 603" 100 0 0 100 on_sb - ));
DATA(insert OID = 372 ( on_sb PGUID 12 f t t t 2 f 16 "601 603" 100 0 0 100 on_sb - ));
DESCR("contained in");
DATA(insert OID = 373 ( inter_sb PGUID 11 f t t t 2 f 16 "601 603" 100 0 0 100 inter_sb - ));
DATA(insert OID = 373 ( inter_sb PGUID 12 f t t t 2 f 16 "601 603" 100 0 0 100 inter_sb - ));
DESCR("intersects?");
/* OIDS 400 - 499 */
@ -954,11 +952,11 @@ DESCR("");
DATA(insert OID = 724 ( set_bit PGUID 12 f t t t 3 f 17 "17 23 23" 100 0 0 100 byteaSetBit - ));
DESCR("");
DATA(insert OID = 725 ( dist_pl PGUID 11 f t t t 2 f 701 "600 628" 100 0 0 100 dist_pl - ));
DATA(insert OID = 725 ( dist_pl PGUID 12 f t t t 2 f 701 "600 628" 100 0 0 100 dist_pl - ));
DESCR("distance between point and line");
DATA(insert OID = 726 ( dist_lb PGUID 11 f t t t 2 f 701 "628 603" 100 0 0 100 dist_lb - ));
DATA(insert OID = 726 ( dist_lb PGUID 12 f t t t 2 f 701 "628 603" 100 0 0 100 dist_lb - ));
DESCR("distance between line and box");
DATA(insert OID = 727 ( dist_sl PGUID 11 f t t t 2 f 701 "601 628" 100 0 0 100 dist_sl - ));
DATA(insert OID = 727 ( dist_sl PGUID 12 f t t t 2 f 701 "601 628" 100 0 0 100 dist_sl - ));
DESCR("distance between lseg and line");
DATA(insert OID = 728 ( dist_cpoly PGUID 12 f t t t 2 f 701 "718 604" 100 0 0 100 dist_cpoly - ));
DESCR("distance between");
@ -1190,15 +1188,15 @@ DESCR("large object create");
DATA(insert OID = 958 ( lo_tell PGUID 12 f t f t 1 f 23 "23" 100 0 0 100 lo_tell - ));
DESCR("large object position");
DATA(insert OID = 959 ( on_pl PGUID 11 f t t t 2 f 16 "600 628" 100 0 10 100 on_pl - ));
DATA(insert OID = 959 ( on_pl PGUID 12 f t t t 2 f 16 "600 628" 100 0 10 100 on_pl - ));
DESCR("point on line?");
DATA(insert OID = 960 ( on_sl PGUID 11 f t t t 2 f 16 "601 628" 100 0 10 100 on_sl - ));
DATA(insert OID = 960 ( on_sl PGUID 12 f t t t 2 f 16 "601 628" 100 0 10 100 on_sl - ));
DESCR("lseg on line?");
DATA(insert OID = 961 ( close_pl PGUID 11 f t t t 2 f 600 "600 628" 100 0 10 100 close_pl - ));
DATA(insert OID = 961 ( close_pl PGUID 12 f t t t 2 f 600 "600 628" 100 0 10 100 close_pl - ));
DESCR("closest point on line");
DATA(insert OID = 962 ( close_sl PGUID 11 f t t t 2 f 600 "601 628" 100 0 10 100 close_sl - ));
DATA(insert OID = 962 ( close_sl PGUID 12 f t t t 2 f 600 "601 628" 100 0 10 100 close_sl - ));
DESCR("closest point to line segment on line");
DATA(insert OID = 963 ( close_lb PGUID 11 f t t t 2 f 600 "628 603" 100 0 10 100 close_lb - ));
DATA(insert OID = 963 ( close_lb PGUID 12 f t t t 2 f 600 "628 603" 100 0 10 100 close_lb - ));
DESCR("closest point to line on box");
DATA(insert OID = 964 ( lo_unlink PGUID 12 f t f t 1 f 23 "26" 100 0 0 100 lo_unlink - ));
@ -1208,17 +1206,17 @@ DESCR("get oid for regproc");
DATA(insert OID = 973 ( path_inter PGUID 12 f t t t 2 f 16 "602 602" 100 0 10 100 path_inter - ));
DESCR("paths intersect?");
DATA(insert OID = 975 ( area PGUID 11 f t t t 1 f 701 "603" 100 0 0 100 box_area - ));
DATA(insert OID = 975 ( area PGUID 12 f t t t 1 f 701 "603" 100 0 0 100 box_area - ));
DESCR("box area");
DATA(insert OID = 976 ( width PGUID 11 f t t t 1 f 701 "603" 100 0 0 100 box_width - ));
DATA(insert OID = 976 ( width PGUID 12 f t t t 1 f 701 "603" 100 0 0 100 box_width - ));
DESCR("box width");
DATA(insert OID = 977 ( height PGUID 11 f t t t 1 f 701 "603" 100 0 0 100 box_height - ));
DATA(insert OID = 977 ( height PGUID 12 f t t t 1 f 701 "603" 100 0 0 100 box_height - ));
DESCR("box height");
DATA(insert OID = 978 ( box_distance PGUID 11 f t t t 2 f 701 "603 603" 100 0 0 100 box_distance - ));
DATA(insert OID = 978 ( box_distance PGUID 12 f t t t 2 f 701 "603 603" 100 0 0 100 box_distance - ));
DESCR("distance between boxes");
DATA(insert OID = 980 ( box_intersect PGUID 11 f t t t 2 f 603 "603 603" 100 0 0 100 box_intersect - ));
DATA(insert OID = 980 ( box_intersect PGUID 12 f t t t 2 f 603 "603 603" 100 0 0 100 box_intersect - ));
DESCR("box intersection (another box)");
DATA(insert OID = 981 ( diagonal PGUID 11 f t t t 1 f 601 "603" 100 0 0 100 box_diagonal - ));
DATA(insert OID = 981 ( diagonal PGUID 12 f t t t 1 f 601 "603" 100 0 0 100 box_diagonal - ));
DESCR("box diagonal");
DATA(insert OID = 982 ( path_n_lt PGUID 12 f t t t 2 f 16 "602 602" 100 0 0 100 path_n_lt - ));
DESCR("less-than");
@ -1232,29 +1230,29 @@ DATA(insert OID = 986 ( path_n_ge PGUID 12 f t t t 2 f 16 "602 602" 100 0 0
DESCR("greater-than-or-equal");
DATA(insert OID = 987 ( path_length PGUID 12 f t t t 1 f 701 "602" 100 0 1 0 path_length - ));
DESCR("sum of path segments");
DATA(insert OID = 988 ( point_ne PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_ne - ));
DATA(insert OID = 988 ( point_ne PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_ne - ));
DESCR("not equal");
DATA(insert OID = 989 ( point_vert PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_vert - ));
DESCR("vertical?");
DATA(insert OID = 990 ( point_horiz PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_horiz - ));
DESCR("horizontal?");
DATA(insert OID = 991 ( point_distance PGUID 11 f t t t 2 f 701 "600 600" 100 0 0 100 point_distance - ));
DATA(insert OID = 989 ( point_vert PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_vert - ));
DESCR("vertically aligned?");
DATA(insert OID = 990 ( point_horiz PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_horiz - ));
DESCR("horizontally aligned?");
DATA(insert OID = 991 ( point_distance PGUID 12 f t t t 2 f 701 "600 600" 100 0 0 100 point_distance - ));
DESCR("distance between");
DATA(insert OID = 992 ( slope PGUID 11 f t t t 2 f 701 "600 600" 100 0 0 100 point_slope - ));
DATA(insert OID = 992 ( slope PGUID 12 f t t t 2 f 701 "600 600" 100 0 0 100 point_slope - ));
DESCR("slope between points");
DATA(insert OID = 993 ( lseg PGUID 11 f t t t 2 f 601 "600 600" 100 0 0 100 lseg_construct - ));
DATA(insert OID = 993 ( lseg PGUID 12 f t t t 2 f 601 "600 600" 100 0 0 100 lseg_construct - ));
DESCR("convert points to line segment");
DATA(insert OID = 994 ( lseg_intersect PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_intersect - ));
DESCR("intersects?");
DATA(insert OID = 995 ( lseg_parallel PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_parallel - ));
DATA(insert OID = 994 ( lseg_intersect PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_intersect - ));
DESCR("intersect?");
DATA(insert OID = 995 ( lseg_parallel PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_parallel - ));
DESCR("parallel?");
DATA(insert OID = 996 ( lseg_perp PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_perp - ));
DATA(insert OID = 996 ( lseg_perp PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_perp - ));
DESCR("perpendicular?");
DATA(insert OID = 997 ( lseg_vertical PGUID 11 f t t t 1 f 16 "601" 100 0 0 100 lseg_vertical - ));
DATA(insert OID = 997 ( lseg_vertical PGUID 12 f t t t 1 f 16 "601" 100 0 0 100 lseg_vertical - ));
DESCR("vertical?");
DATA(insert OID = 998 ( lseg_horizontal PGUID 11 f t t t 1 f 16 "601" 100 0 0 100 lseg_horizontal - ));
DATA(insert OID = 998 ( lseg_horizontal PGUID 12 f t t t 1 f 16 "601" 100 0 0 100 lseg_horizontal - ));
DESCR("horizontal?");
DATA(insert OID = 999 ( lseg_eq PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_eq - ));
DATA(insert OID = 999 ( lseg_eq PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_eq - ));
DESCR("equal");
/* OIDS 1000 - 1999 */
@ -1365,13 +1363,13 @@ DESCR("(internal)");
DATA(insert OID = 1145 ( time_eq PGUID 12 f t t t 2 f 16 "1083 1083" 100 0 0 100 time_eq - ));
DESCR("equal");
DATA(insert OID = 1146 ( circle_add_pt PGUID 11 f t t t 2 f 718 "718 600" 100 0 0 100 circle_add_pt - ));
DATA(insert OID = 1146 ( circle_add_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_add_pt - ));
DESCR("addition");
DATA(insert OID = 1147 ( circle_sub_pt PGUID 11 f t t t 2 f 718 "718 600" 100 0 0 100 circle_sub_pt - ));
DATA(insert OID = 1147 ( circle_sub_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_sub_pt - ));
DESCR("subtract");
DATA(insert OID = 1148 ( circle_mul_pt PGUID 11 f t t t 2 f 718 "718 600" 100 0 0 100 circle_mul_pt - ));
DATA(insert OID = 1148 ( circle_mul_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_mul_pt - ));
DESCR("multiply");
DATA(insert OID = 1149 ( circle_div_pt PGUID 11 f t t t 2 f 718 "718 600" 100 0 0 100 circle_div_pt - ));
DATA(insert OID = 1149 ( circle_div_pt PGUID 12 f t t t 2 f 718 "718 600" 100 0 0 100 circle_div_pt - ));
DESCR("divide");
DATA(insert OID = 1150 ( timestamp_in PGUID 12 f t f t 1 f 1184 "0" 100 0 0 100 timestamp_in - ));
@ -1730,27 +1728,27 @@ DESCR("convert (no-op)");
DATA(insert OID = 1405 ( int4 PGUID 14 f t t t 1 f 23 "23" 100 0 0 100 "select $1" - ));
DESCR("convert (no-op)");
DATA(insert OID = 1406 ( isvertical PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_vert - ));
DESCR("vertical?");
DATA(insert OID = 1407 ( ishorizontal PGUID 11 f t t t 2 f 16 "600 600" 100 0 0 100 point_horiz - ));
DESCR("horizontal?");
DATA(insert OID = 1408 ( isparallel PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_parallel - ));
DATA(insert OID = 1406 ( isvertical PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_vert - ));
DESCR("vertically aligned?");
DATA(insert OID = 1407 ( ishorizontal PGUID 12 f t t t 2 f 16 "600 600" 100 0 0 100 point_horiz - ));
DESCR("horizontally aligned?");
DATA(insert OID = 1408 ( isparallel PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_parallel - ));
DESCR("parallel?");
DATA(insert OID = 1409 ( isperp PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_perp - ));
DATA(insert OID = 1409 ( isperp PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_perp - ));
DESCR("perpendicular?");
DATA(insert OID = 1410 ( isvertical PGUID 11 f t t t 1 f 16 "601" 100 0 0 100 lseg_vertical - ));
DATA(insert OID = 1410 ( isvertical PGUID 12 f t t t 1 f 16 "601" 100 0 0 100 lseg_vertical - ));
DESCR("vertical?");
DATA(insert OID = 1411 ( ishorizontal PGUID 11 f t t t 1 f 16 "601" 100 0 0 100 lseg_horizontal - ));
DATA(insert OID = 1411 ( ishorizontal PGUID 12 f t t t 1 f 16 "601" 100 0 0 100 lseg_horizontal - ));
DESCR("horizontal?");
DATA(insert OID = 1412 ( isparallel PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_parallel - ));
DATA(insert OID = 1412 ( isparallel PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_parallel - ));
DESCR("lines parallel?");
DATA(insert OID = 1413 ( isperp PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_perp - ));
DATA(insert OID = 1413 ( isperp PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_perp - ));
DESCR("lines perpendicular?");
DATA(insert OID = 1414 ( isvertical PGUID 11 f t t t 1 f 16 "628" 100 0 0 100 line_vertical - ));
DATA(insert OID = 1414 ( isvertical PGUID 12 f t t t 1 f 16 "628" 100 0 0 100 line_vertical - ));
DESCR("lines vertical?");
DATA(insert OID = 1415 ( ishorizontal PGUID 11 f t t t 1 f 16 "628" 100 0 0 100 line_horizontal - ));
DATA(insert OID = 1415 ( ishorizontal PGUID 12 f t t t 1 f 16 "628" 100 0 0 100 line_horizontal - ));
DESCR("lines horizontal?");
DATA(insert OID = 1416 ( point PGUID 11 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DATA(insert OID = 1416 ( point PGUID 12 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DESCR("center of");
DATA(insert OID = 1417 ( isnottrue PGUID 12 f t t f 1 f 16 "16" 100 0 0 100 isnottrue - ));
@ -1758,15 +1756,15 @@ DESCR("bool is not true (ie, false or unknown)");
DATA(insert OID = 1418 ( isnotfalse PGUID 12 f t t f 1 f 16 "16" 100 0 0 100 isnotfalse - ));
DESCR("bool is not false (ie, true or unknown)");
DATA(insert OID = 1421 ( box PGUID 11 f t t t 2 f 603 "600 600" 100 0 0 100 box - ));
DATA(insert OID = 1421 ( box PGUID 12 f t t t 2 f 603 "600 600" 100 0 0 100 points_box - ));
DESCR("convert points to box");
DATA(insert OID = 1422 ( box_add PGUID 11 f t t t 2 f 603 "603 600" 100 0 0 100 box_add - ));
DATA(insert OID = 1422 ( box_add PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100 box_add - ));
DESCR("add point to box (translate)");
DATA(insert OID = 1423 ( box_sub PGUID 11 f t t t 2 f 603 "603 600" 100 0 0 100 box_sub - ));
DATA(insert OID = 1423 ( box_sub PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100 box_sub - ));
DESCR("subtract point from box (translate)");
DATA(insert OID = 1424 ( box_mul PGUID 11 f t t t 2 f 603 "603 600" 100 0 0 100 box_mul - ));
DATA(insert OID = 1424 ( box_mul PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100 box_mul - ));
DESCR("multiply box by point (scale)");
DATA(insert OID = 1425 ( box_div PGUID 11 f t t t 2 f 603 "603 600" 100 0 0 100 box_div - ));
DATA(insert OID = 1425 ( box_div PGUID 12 f t t t 2 f 603 "603 600" 100 0 0 100 box_div - ));
DESCR("divide box by point (scale)");
DATA(insert OID = 1426 ( path_contain_pt PGUID 14 f t t t 2 f 16 "602 600" 100 0 0 100 "select on_ppath($2, $1)" - ));
DESCR("path contains point?");
@ -1801,15 +1799,15 @@ DESCR("multiply (rotate/scale path)");
DATA(insert OID = 1439 ( path_div_pt PGUID 12 f t t t 2 f 602 "602 600" 100 0 0 100 path_div_pt - ));
DESCR("divide (rotate/scale path)");
DATA(insert OID = 1440 ( point PGUID 11 f t t t 2 f 600 "701 701" 100 0 0 100 point - ));
DATA(insert OID = 1440 ( point PGUID 12 f t t t 2 f 600 "701 701" 100 0 0 100 construct_point - ));
DESCR("convert x, y to point");
DATA(insert OID = 1441 ( point_add PGUID 11 f t t t 2 f 600 "600 600" 100 0 0 100 point_add - ));
DATA(insert OID = 1441 ( point_add PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100 point_add - ));
DESCR("add points (translate)");
DATA(insert OID = 1442 ( point_sub PGUID 11 f t t t 2 f 600 "600 600" 100 0 0 100 point_sub - ));
DATA(insert OID = 1442 ( point_sub PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100 point_sub - ));
DESCR("subtract points (translate)");
DATA(insert OID = 1443 ( point_mul PGUID 11 f t t t 2 f 600 "600 600" 100 0 0 100 point_mul - ));
DATA(insert OID = 1443 ( point_mul PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100 point_mul - ));
DESCR("multiply points (scale/rotate)");
DATA(insert OID = 1444 ( point_div PGUID 11 f t t t 2 f 600 "600 600" 100 0 0 100 point_div - ));
DATA(insert OID = 1444 ( point_div PGUID 12 f t t t 2 f 600 "600 600" 100 0 0 100 point_div - ));
DESCR("divide points (scale/rotate)");
DATA(insert OID = 1445 ( poly_npoints PGUID 12 f t t t 1 f 23 "604" 100 0 0 100 poly_npoints - ));
@ -1823,130 +1821,130 @@ DESCR("convert box to polygon");
DATA(insert OID = 1449 ( polygon PGUID 12 f t t t 1 f 604 "602" 100 0 0 100 path_poly - ));
DESCR("convert path to polygon");
DATA(insert OID = 1450 ( circle_in PGUID 11 f t t t 1 f 718 "0" 100 0 1 0 circle_in - ));
DATA(insert OID = 1450 ( circle_in PGUID 12 f t t t 1 f 718 "0" 100 0 1 0 circle_in - ));
DESCR("(internal)");
DATA(insert OID = 1451 ( circle_out PGUID 11 f t t t 1 f 23 "0" 100 0 1 0 circle_out - ));
DATA(insert OID = 1451 ( circle_out PGUID 12 f t t t 1 f 23 "718" 100 0 1 0 circle_out - ));
DESCR("(internal)");
DATA(insert OID = 1452 ( circle_same PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_same - ));
DATA(insert OID = 1452 ( circle_same PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_same - ));
DESCR("same as");
DATA(insert OID = 1453 ( circle_contain PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_contain - ));
DATA(insert OID = 1453 ( circle_contain PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_contain - ));
DESCR("contains");
DATA(insert OID = 1454 ( circle_left PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_left - ));
DATA(insert OID = 1454 ( circle_left PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_left - ));
DESCR("is left of");
DATA(insert OID = 1455 ( circle_overleft PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overleft - ));
DATA(insert OID = 1455 ( circle_overleft PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overleft - ));
DESCR("overlaps, but does not extend to right of");
DATA(insert OID = 1456 ( circle_overright PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overright - ));
DATA(insert OID = 1456 ( circle_overright PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overright - ));
DESCR("");
DATA(insert OID = 1457 ( circle_right PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_right - ));
DESCR("is left of");
DATA(insert OID = 1458 ( circle_contained PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_contained - ));
DATA(insert OID = 1457 ( circle_right PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_right - ));
DESCR("is right of");
DATA(insert OID = 1458 ( circle_contained PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_contained - ));
DESCR("");
DATA(insert OID = 1459 ( circle_overlap PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overlap - ));
DATA(insert OID = 1459 ( circle_overlap PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_overlap - ));
DESCR("overlaps");
DATA(insert OID = 1460 ( circle_below PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_below - ));
DATA(insert OID = 1460 ( circle_below PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_below - ));
DESCR("is below");
DATA(insert OID = 1461 ( circle_above PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_above - ));
DATA(insert OID = 1461 ( circle_above PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_above - ));
DESCR("is above");
DATA(insert OID = 1462 ( circle_eq PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_eq - ));
DESCR("equal");
DATA(insert OID = 1463 ( circle_ne PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_ne - ));
DESCR("not equal");
DATA(insert OID = 1464 ( circle_lt PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_lt - ));
DESCR("less-than");
DATA(insert OID = 1465 ( circle_gt PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_gt - ));
DESCR("greater-than");
DATA(insert OID = 1466 ( circle_le PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_le - ));
DESCR("less-than-or-equal");
DATA(insert OID = 1467 ( circle_ge PGUID 11 f t t t 2 f 16 "718 718" 100 0 1 0 circle_ge - ));
DESCR("greater-than-or-equal");
DATA(insert OID = 1468 ( area PGUID 11 f t t t 1 f 701 "718" 100 0 1 0 circle_area - ));
DATA(insert OID = 1462 ( circle_eq PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_eq - ));
DESCR("equal by area");
DATA(insert OID = 1463 ( circle_ne PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_ne - ));
DESCR("not equal by area");
DATA(insert OID = 1464 ( circle_lt PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_lt - ));
DESCR("less-than by area");
DATA(insert OID = 1465 ( circle_gt PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_gt - ));
DESCR("greater-than by area");
DATA(insert OID = 1466 ( circle_le PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_le - ));
DESCR("less-than-or-equal by area");
DATA(insert OID = 1467 ( circle_ge PGUID 12 f t t t 2 f 16 "718 718" 100 0 1 0 circle_ge - ));
DESCR("greater-than-or-equal by area");
DATA(insert OID = 1468 ( area PGUID 12 f t t t 1 f 701 "718" 100 0 1 0 circle_area - ));
DESCR("area of circle");
DATA(insert OID = 1469 ( diameter PGUID 11 f t t t 1 f 701 "718" 100 0 1 0 circle_diameter - ));
DATA(insert OID = 1469 ( diameter PGUID 12 f t t t 1 f 701 "718" 100 0 1 0 circle_diameter - ));
DESCR("diameter of circle");
DATA(insert OID = 1470 ( radius PGUID 11 f t t t 1 f 701 "718" 100 0 1 0 circle_radius - ));
DATA(insert OID = 1470 ( radius PGUID 12 f t t t 1 f 701 "718" 100 0 1 0 circle_radius - ));
DESCR("radius of circle");
DATA(insert OID = 1471 ( circle_distance PGUID 11 f t t t 2 f 701 "718 718" 100 0 1 0 circle_distance - ));
DATA(insert OID = 1471 ( circle_distance PGUID 12 f t t t 2 f 701 "718 718" 100 0 1 0 circle_distance - ));
DESCR("distance between");
DATA(insert OID = 1472 ( circle_center PGUID 11 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DATA(insert OID = 1472 ( circle_center PGUID 12 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DESCR("center of");
DATA(insert OID = 1473 ( circle PGUID 11 f t t t 2 f 718 "600 701" 100 0 1 0 circle - ));
DATA(insert OID = 1473 ( circle PGUID 12 f t t t 2 f 718 "600 701" 100 0 1 0 cr_circle - ));
DESCR("convert point and radius to circle");
DATA(insert OID = 1474 ( circle PGUID 12 f t t t 1 f 718 "604" 100 0 1 0 poly_circle - ));
DESCR("convert polygon to circle");
DATA(insert OID = 1475 ( polygon PGUID 12 f t t t 2 f 604 "23 718" 100 0 1 0 circle_poly - ));
DESCR("convert vertex count and circle to polygon");
DATA(insert OID = 1476 ( dist_pc PGUID 11 f t t t 2 f 701 "600 718" 100 0 1 0 dist_pc - ));
DATA(insert OID = 1476 ( dist_pc PGUID 12 f t t t 2 f 701 "600 718" 100 0 1 0 dist_pc - ));
DESCR("distance between point and circle");
DATA(insert OID = 1477 ( circle_contain_pt PGUID 11 f t t t 2 f 16 "718 600" 100 0 0 100 circle_contain_pt - ));
DATA(insert OID = 1477 ( circle_contain_pt PGUID 12 f t t t 2 f 16 "718 600" 100 0 0 100 circle_contain_pt - ));
DESCR("circle contains point?");
DATA(insert OID = 1478 ( pt_contained_circle PGUID 11 f t t t 2 f 16 "600 718" 100 0 0 100 pt_contained_circle - ));
DATA(insert OID = 1478 ( pt_contained_circle PGUID 12 f t t t 2 f 16 "600 718" 100 0 0 100 pt_contained_circle - ));
DESCR("point inside circle?");
DATA(insert OID = 1479 ( circle PGUID 11 f t t t 1 f 718 "603" 100 0 1 0 box_circle - ));
DATA(insert OID = 1479 ( circle PGUID 12 f t t t 1 f 718 "603" 100 0 1 0 box_circle - ));
DESCR("convert box to circle");
DATA(insert OID = 1480 ( box PGUID 11 f t t t 1 f 603 "718" 100 0 1 0 circle_box - ));
DATA(insert OID = 1480 ( box PGUID 12 f t t t 1 f 603 "718" 100 0 1 0 circle_box - ));
DESCR("convert circle to box");
DATA(insert OID = 1481 ( tinterval PGUID 12 f t f t 2 f 704 "702 702" 100 0 0 100 mktinterval - ));
DESCR("convert to tinterval");
DATA(insert OID = 1482 ( lseg_ne PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_ne - ));
DATA(insert OID = 1482 ( lseg_ne PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_ne - ));
DESCR("not equal");
DATA(insert OID = 1483 ( lseg_lt PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_lt - ));
DESCR("less-than");
DATA(insert OID = 1484 ( lseg_le PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_le - ));
DESCR("less-than-or-equal");
DATA(insert OID = 1485 ( lseg_gt PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_gt - ));
DESCR("greater-than");
DATA(insert OID = 1486 ( lseg_ge PGUID 11 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_ge - ));
DESCR("greater-than-or-equal");
DATA(insert OID = 1487 ( lseg_length PGUID 11 f t t t 1 f 701 "601" 100 0 1 0 lseg_length - ));
DATA(insert OID = 1483 ( lseg_lt PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_lt - ));
DESCR("less-than by length");
DATA(insert OID = 1484 ( lseg_le PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_le - ));
DESCR("less-than-or-equal by length");
DATA(insert OID = 1485 ( lseg_gt PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_gt - ));
DESCR("greater-than by length");
DATA(insert OID = 1486 ( lseg_ge PGUID 12 f t t t 2 f 16 "601 601" 100 0 0 100 lseg_ge - ));
DESCR("greater-than-or-equal by length");
DATA(insert OID = 1487 ( lseg_length PGUID 12 f t t t 1 f 701 "601" 100 0 1 0 lseg_length - ));
DESCR("distance between endpoints");
DATA(insert OID = 1488 ( close_ls PGUID 11 f t t t 2 f 600 "628 601" 100 0 10 100 close_ls - ));
DATA(insert OID = 1488 ( close_ls PGUID 12 f t t t 2 f 600 "628 601" 100 0 10 100 close_ls - ));
DESCR("closest point to line on line segment");
DATA(insert OID = 1489 ( close_lseg PGUID 11 f t t t 2 f 600 "601 601" 100 0 10 100 close_lseg - ));
DATA(insert OID = 1489 ( close_lseg PGUID 12 f t t t 2 f 600 "601 601" 100 0 10 100 close_lseg - ));
DESCR("closest point to line segment on line segment");
DATA(insert OID = 1490 ( line_in PGUID 11 f t t t 1 f 628 "0" 100 0 0 100 line_in - ));
DATA(insert OID = 1490 ( line_in PGUID 12 f t t t 1 f 628 "0" 100 0 0 100 line_in - ));
DESCR("(internal)");
DATA(insert OID = 1491 ( line_out PGUID 11 f t t t 1 f 23 "0" 100 0 0 100 line_out - ));
DATA(insert OID = 1491 ( line_out PGUID 12 f t t t 1 f 23 "628" 100 0 0 100 line_out - ));
DESCR("(internal)");
DATA(insert OID = 1492 ( line_eq PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_eq - ));
DATA(insert OID = 1492 ( line_eq PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_eq - ));
DESCR("lines equal?");
DATA(insert OID = 1493 ( line PGUID 11 f t t t 2 f 628 "600 600" 100 0 0 100 line_construct_pp - ));
DATA(insert OID = 1493 ( line PGUID 12 f t t t 2 f 628 "600 600" 100 0 0 100 line_construct_pp - ));
DESCR("line from points");
DATA(insert OID = 1494 ( line_interpt PGUID 11 f t t t 2 f 600 "628 628" 100 0 0 100 line_interpt - ));
DATA(insert OID = 1494 ( line_interpt PGUID 12 f t t t 2 f 600 "628 628" 100 0 0 100 line_interpt - ));
DESCR("intersection point");
DATA(insert OID = 1495 ( line_intersect PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_intersect - ));
DATA(insert OID = 1495 ( line_intersect PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_intersect - ));
DESCR("lines intersect?");
DATA(insert OID = 1496 ( line_parallel PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_parallel - ));
DATA(insert OID = 1496 ( line_parallel PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_parallel - ));
DESCR("lines parallel?");
DATA(insert OID = 1497 ( line_perp PGUID 11 f t t t 2 f 16 "628 628" 100 0 0 100 line_perp - ));
DATA(insert OID = 1497 ( line_perp PGUID 12 f t t t 2 f 16 "628 628" 100 0 0 100 line_perp - ));
DESCR("lines perpendicular?");
DATA(insert OID = 1498 ( line_vertical PGUID 11 f t t t 1 f 16 "628" 100 0 0 100 line_vertical - ));
DATA(insert OID = 1498 ( line_vertical PGUID 12 f t t t 1 f 16 "628" 100 0 0 100 line_vertical - ));
DESCR("lines vertical?");
DATA(insert OID = 1499 ( line_horizontal PGUID 11 f t t t 1 f 16 "628" 100 0 0 100 line_horizontal - ));
DATA(insert OID = 1499 ( line_horizontal PGUID 12 f t t t 1 f 16 "628" 100 0 0 100 line_horizontal - ));
DESCR("lines horizontal?");
/* OIDS 1500 - 1599 */
DATA(insert OID = 1530 ( length PGUID 11 f t t t 1 f 701 "601" 100 0 1 0 lseg_length - ));
DATA(insert OID = 1530 ( length PGUID 12 f t t t 1 f 701 "601" 100 0 1 0 lseg_length - ));
DESCR("distance between endpoints");
DATA(insert OID = 1531 ( length PGUID 12 f t t t 1 f 701 "602" 100 0 1 0 path_length - ));
DESCR("sum of path segments");
DATA(insert OID = 1532 ( point PGUID 11 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - ));
DATA(insert OID = 1532 ( point PGUID 12 f t t t 1 f 600 "601" 100 0 0 100 lseg_center - ));
DESCR("center of");
DATA(insert OID = 1533 ( point PGUID 12 f t t t 1 f 600 "602" 100 0 0 100 path_center - ));
DESCR("center of");
DATA(insert OID = 1534 ( point PGUID 11 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DATA(insert OID = 1534 ( point PGUID 12 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DESCR("center of");
DATA(insert OID = 1540 ( point PGUID 12 f t t t 1 f 600 "604" 100 0 0 100 poly_center - ));
DESCR("center of");
DATA(insert OID = 1541 ( lseg PGUID 11 f t t t 1 f 601 "603" 100 0 0 100 box_diagonal - ));
DESCR("");
DATA(insert OID = 1542 ( center PGUID 11 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DATA(insert OID = 1541 ( lseg PGUID 12 f t t t 1 f 601 "603" 100 0 0 100 box_diagonal - ));
DESCR("diagonal of");
DATA(insert OID = 1542 ( center PGUID 12 f t t t 1 f 600 "603" 100 1 0 100 box_center - ));
DESCR("center of");
DATA(insert OID = 1543 ( center PGUID 11 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DATA(insert OID = 1543 ( center PGUID 12 f t t t 1 f 600 "718" 100 0 1 0 circle_center - ));
DESCR("center of");
DATA(insert OID = 1544 ( polygon PGUID 14 f t t t 1 f 604 "718" 100 0 0 100 "select polygon(12, $1)" - ));
DESCR("convert circle to 12-vertex polygon");

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: geo_decls.h,v 1.30 2000/07/29 18:46:05 tgl Exp $
* $Id: geo_decls.h,v 1.31 2000/07/30 20:43:49 tgl Exp $
*
* NOTE
* These routines do *not* use the float types from adt/.
@ -34,19 +34,19 @@
#ifdef EPSILON
#define FPzero(A) (fabs(A) <= EPSILON)
#define FPeq(A,B) (fabs((A) - (B)) <= EPSILON)
#define FPne(A,B) (fabs((A) - (B)) > EPSILON)
#define FPlt(A,B) ((B) - (A) > EPSILON)
#define FPle(A,B) ((A) - (B) <= EPSILON)
#define FPgt(A,B) ((A) - (B) > EPSILON)
#define FPge(A,B) ((B) - (A) <= EPSILON)
#else
#define FPzero(A) (A == 0)
#define FPnzero(A) (A != 0)
#define FPeq(A,B) (A == B)
#define FPne(A,B) (A != B)
#define FPlt(A,B) (A < B)
#define FPle(A,B) (A <= B)
#define FPgt(A,B) (A > B)
#define FPge(A,B) (A >= B)
#define FPzero(A) ((A) == 0)
#define FPeq(A,B) ((A) == (B))
#define FPne(A,B) ((A) != (B))
#define FPlt(A,B) ((A) < (B))
#define FPle(A,B) ((A) <= (B))
#define FPgt(A,B) ((A) > (B))
#define FPge(A,B) ((A) >= (B))
#endif
#define HYPOT(A, B) sqrt((A) * (A) + (B) * (B))
@ -187,125 +187,115 @@ typedef struct
*/
/* public point routines */
extern Point *point_in(char *str);
extern char *point_out(Point *pt);
extern bool point_left(Point *pt1, Point *pt2);
extern bool point_right(Point *pt1, Point *pt2);
extern bool point_above(Point *pt1, Point *pt2);
extern bool point_below(Point *pt1, Point *pt2);
extern bool point_vert(Point *pt1, Point *pt2);
extern bool point_horiz(Point *pt1, Point *pt2);
extern bool point_eq(Point *pt1, Point *pt2);
extern bool point_ne(Point *pt1, Point *pt2);
extern int32 pointdist(Point *p1, Point *p2);
extern double *point_distance(Point *pt1, Point *pt2);
extern double *point_slope(Point *pt1, Point *pt2);
extern Datum point_in(PG_FUNCTION_ARGS);
extern Datum point_out(PG_FUNCTION_ARGS);
extern Datum construct_point(PG_FUNCTION_ARGS);
extern Datum point_left(PG_FUNCTION_ARGS);
extern Datum point_right(PG_FUNCTION_ARGS);
extern Datum point_above(PG_FUNCTION_ARGS);
extern Datum point_below(PG_FUNCTION_ARGS);
extern Datum point_vert(PG_FUNCTION_ARGS);
extern Datum point_horiz(PG_FUNCTION_ARGS);
extern Datum point_eq(PG_FUNCTION_ARGS);
extern Datum point_ne(PG_FUNCTION_ARGS);
extern Datum point_distance(PG_FUNCTION_ARGS);
extern Datum point_slope(PG_FUNCTION_ARGS);
extern Datum point_add(PG_FUNCTION_ARGS);
extern Datum point_sub(PG_FUNCTION_ARGS);
extern Datum point_mul(PG_FUNCTION_ARGS);
extern Datum point_div(PG_FUNCTION_ARGS);
/* private routines */
extern double point_dt(Point *pt1, Point *pt2);
extern double point_sl(Point *pt1, Point *pt2);
extern Point *point(float8 *x, float8 *y);
extern Point *point_add(Point *p1, Point *p2);
extern Point *point_sub(Point *p1, Point *p2);
extern Point *point_mul(Point *p1, Point *p2);
extern Point *point_div(Point *p1, Point *p2);
/* public lseg routines */
extern LSEG *lseg_in(char *str);
extern char *lseg_out(LSEG *ls);
extern bool lseg_intersect(LSEG *l1, LSEG *l2);
extern bool lseg_parallel(LSEG *l1, LSEG *l2);
extern bool lseg_perp(LSEG *l1, LSEG *l2);
extern bool lseg_vertical(LSEG *lseg);
extern bool lseg_horizontal(LSEG *lseg);
extern bool lseg_eq(LSEG *l1, LSEG *l2);
extern bool lseg_ne(LSEG *l1, LSEG *l2);
extern bool lseg_lt(LSEG *l1, LSEG *l2);
extern bool lseg_le(LSEG *l1, LSEG *l2);
extern bool lseg_gt(LSEG *l1, LSEG *l2);
extern bool lseg_ge(LSEG *l1, LSEG *l2);
extern LSEG *lseg_construct(Point *pt1, Point *pt2);
extern double *lseg_length(LSEG *lseg);
extern double *lseg_distance(LSEG *l1, LSEG *l2);
extern Point *lseg_center(LSEG *lseg);
extern Point *lseg_interpt(LSEG *l1, LSEG *l2);
extern double *dist_pl(Point *pt, LINE *line);
extern double *dist_ps(Point *pt, LSEG *lseg);
extern Datum lseg_in(PG_FUNCTION_ARGS);
extern Datum lseg_out(PG_FUNCTION_ARGS);
extern Datum lseg_intersect(PG_FUNCTION_ARGS);
extern Datum lseg_parallel(PG_FUNCTION_ARGS);
extern Datum lseg_perp(PG_FUNCTION_ARGS);
extern Datum lseg_vertical(PG_FUNCTION_ARGS);
extern Datum lseg_horizontal(PG_FUNCTION_ARGS);
extern Datum lseg_eq(PG_FUNCTION_ARGS);
extern Datum lseg_ne(PG_FUNCTION_ARGS);
extern Datum lseg_lt(PG_FUNCTION_ARGS);
extern Datum lseg_le(PG_FUNCTION_ARGS);
extern Datum lseg_gt(PG_FUNCTION_ARGS);
extern Datum lseg_ge(PG_FUNCTION_ARGS);
extern Datum lseg_construct(PG_FUNCTION_ARGS);
extern Datum lseg_length(PG_FUNCTION_ARGS);
extern Datum lseg_distance(PG_FUNCTION_ARGS);
extern Datum lseg_center(PG_FUNCTION_ARGS);
extern Datum lseg_interpt(PG_FUNCTION_ARGS);
extern Datum dist_pl(PG_FUNCTION_ARGS);
extern Datum dist_ps(PG_FUNCTION_ARGS);
extern Datum dist_ppath(PG_FUNCTION_ARGS);
extern double *dist_pb(Point *pt, BOX *box);
extern double *dist_sl(LSEG *lseg, LINE *line);
extern double *dist_sb(LSEG *lseg, BOX *box);
extern double *dist_lb(LINE *line, BOX *box);
extern Point *close_lseg(LSEG *l1, LSEG *l2);
extern Point *close_pl(Point *pt, LINE *line);
extern Point *close_ps(Point *pt, LSEG *lseg);
extern Point *close_pb(Point *pt, BOX *box);
extern Point *close_sl(LSEG *lseg, LINE *line);
extern Point *close_sb(LSEG *lseg, BOX *box);
extern Point *close_ls(LINE *line, LSEG *lseg);
extern Point *close_lb(LINE *line, BOX *box);
extern bool on_pl(Point *pt, LINE *line);
extern bool on_ps(Point *pt, LSEG *lseg);
extern bool on_pb(Point *pt, BOX *box);
extern Datum dist_pb(PG_FUNCTION_ARGS);
extern Datum dist_sl(PG_FUNCTION_ARGS);
extern Datum dist_sb(PG_FUNCTION_ARGS);
extern Datum dist_lb(PG_FUNCTION_ARGS);
extern Datum close_lseg(PG_FUNCTION_ARGS);
extern Datum close_pl(PG_FUNCTION_ARGS);
extern Datum close_ps(PG_FUNCTION_ARGS);
extern Datum close_pb(PG_FUNCTION_ARGS);
extern Datum close_sl(PG_FUNCTION_ARGS);
extern Datum close_sb(PG_FUNCTION_ARGS);
extern Datum close_ls(PG_FUNCTION_ARGS);
extern Datum close_lb(PG_FUNCTION_ARGS);
extern Datum on_pl(PG_FUNCTION_ARGS);
extern Datum on_ps(PG_FUNCTION_ARGS);
extern Datum on_pb(PG_FUNCTION_ARGS);
extern Datum on_ppath(PG_FUNCTION_ARGS);
extern bool on_sl(LSEG *lseg, LINE *line);
extern bool on_sb(LSEG *lseg, BOX *box);
extern bool inter_sl(LSEG *lseg, LINE *line);
extern bool inter_sb(LSEG *lseg, BOX *box);
extern bool inter_lb(LINE *line, BOX *box);
/* private lseg routines */
extern Datum on_sl(PG_FUNCTION_ARGS);
extern Datum on_sb(PG_FUNCTION_ARGS);
extern Datum inter_sl(PG_FUNCTION_ARGS);
extern Datum inter_sb(PG_FUNCTION_ARGS);
extern Datum inter_lb(PG_FUNCTION_ARGS);
/* public line routines */
extern LINE *line_in(char *str);
extern char *line_out(LINE *line);
extern Point *line_interpt(LINE *l1, LINE *l2);
extern double *line_distance(LINE *l1, LINE *l2);
extern LINE *line_construct_pp(Point *pt1, Point *pt2);
extern bool line_intersect(LINE *l1, LINE *l2);
extern bool line_parallel(LINE *l1, LINE *l2);
extern bool line_perp(LINE *l1, LINE *l2);
extern bool line_vertical(LINE *line);
extern bool line_horizontal(LINE *line);
extern bool line_eq(LINE *l1, LINE *l2);
/* private line routines */
extern Datum line_in(PG_FUNCTION_ARGS);
extern Datum line_out(PG_FUNCTION_ARGS);
extern Datum line_interpt(PG_FUNCTION_ARGS);
extern Datum line_distance(PG_FUNCTION_ARGS);
extern Datum line_construct_pp(PG_FUNCTION_ARGS);
extern Datum line_intersect(PG_FUNCTION_ARGS);
extern Datum line_parallel(PG_FUNCTION_ARGS);
extern Datum line_perp(PG_FUNCTION_ARGS);
extern Datum line_vertical(PG_FUNCTION_ARGS);
extern Datum line_horizontal(PG_FUNCTION_ARGS);
extern Datum line_eq(PG_FUNCTION_ARGS);
/* public box routines */
extern BOX *box_in(char *str);
extern char *box_out(BOX *box);
extern bool box_same(BOX *box1, BOX *box2);
extern bool box_overlap(BOX *box1, BOX *box2);
extern bool box_overleft(BOX *box1, BOX *box2);
extern bool box_left(BOX *box1, BOX *box2);
extern bool box_right(BOX *box1, BOX *box2);
extern bool box_overright(BOX *box1, BOX *box2);
extern bool box_contained(BOX *box1, BOX *box2);
extern bool box_contain(BOX *box1, BOX *box2);
extern bool box_below(BOX *box1, BOX *box2);
extern bool box_above(BOX *box1, BOX *box2);
extern bool box_lt(BOX *box1, BOX *box2);
extern bool box_gt(BOX *box1, BOX *box2);
extern bool box_eq(BOX *box1, BOX *box2);
extern bool box_le(BOX *box1, BOX *box2);
extern bool box_ge(BOX *box1, BOX *box2);
extern Point *box_center(BOX *box);
extern double *box_area(BOX *box);
extern double *box_width(BOX *box);
extern double *box_height(BOX *box);
extern double *box_distance(BOX *box1, BOX *box2);
extern Point *box_center(BOX *box);
extern BOX *box_intersect(BOX *box1, BOX *box2);
extern LSEG *box_diagonal(BOX *box);
extern BOX *box(Point *p1, Point *p2);
extern BOX *box_add(BOX *box, Point *p);
extern BOX *box_sub(BOX *box, Point *p);
extern BOX *box_mul(BOX *box, Point *p);
extern BOX *box_div(BOX *box, Point *p);
/* private routines */
extern double box_dt(BOX *box1, BOX *box2);
extern Datum box_in(PG_FUNCTION_ARGS);
extern Datum box_out(PG_FUNCTION_ARGS);
extern Datum box_same(PG_FUNCTION_ARGS);
extern Datum box_overlap(PG_FUNCTION_ARGS);
extern Datum box_overleft(PG_FUNCTION_ARGS);
extern Datum box_left(PG_FUNCTION_ARGS);
extern Datum box_right(PG_FUNCTION_ARGS);
extern Datum box_overright(PG_FUNCTION_ARGS);
extern Datum box_contained(PG_FUNCTION_ARGS);
extern Datum box_contain(PG_FUNCTION_ARGS);
extern Datum box_below(PG_FUNCTION_ARGS);
extern Datum box_above(PG_FUNCTION_ARGS);
extern Datum box_lt(PG_FUNCTION_ARGS);
extern Datum box_gt(PG_FUNCTION_ARGS);
extern Datum box_eq(PG_FUNCTION_ARGS);
extern Datum box_le(PG_FUNCTION_ARGS);
extern Datum box_ge(PG_FUNCTION_ARGS);
extern Datum box_area(PG_FUNCTION_ARGS);
extern Datum box_width(PG_FUNCTION_ARGS);
extern Datum box_height(PG_FUNCTION_ARGS);
extern Datum box_distance(PG_FUNCTION_ARGS);
extern Datum box_center(PG_FUNCTION_ARGS);
extern Datum box_intersect(PG_FUNCTION_ARGS);
extern Datum box_diagonal(PG_FUNCTION_ARGS);
extern Datum points_box(PG_FUNCTION_ARGS);
extern Datum box_add(PG_FUNCTION_ARGS);
extern Datum box_sub(PG_FUNCTION_ARGS);
extern Datum box_mul(PG_FUNCTION_ARGS);
extern Datum box_div(PG_FUNCTION_ARGS);
/* public path routines */
extern Datum path_in(PG_FUNCTION_ARGS);
@ -347,7 +337,6 @@ extern Datum poly_contain(PG_FUNCTION_ARGS);
extern Datum poly_contained(PG_FUNCTION_ARGS);
extern Datum poly_contain_pt(PG_FUNCTION_ARGS);
extern Datum pt_contained_poly(PG_FUNCTION_ARGS);
extern Datum poly_distance(PG_FUNCTION_ARGS);
extern Datum poly_npoints(PG_FUNCTION_ARGS);
extern Datum poly_center(PG_FUNCTION_ARGS);
@ -356,52 +345,48 @@ extern Datum poly_path(PG_FUNCTION_ARGS);
extern Datum box_poly(PG_FUNCTION_ARGS);
/* public circle routines */
extern CIRCLE *circle_in(char *str);
extern char *circle_out(CIRCLE *circle);
extern bool circle_same(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overlap(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overleft(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_left(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_right(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_overright(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contained(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contain(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_below(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_above(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_eq(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_ne(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_lt(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_gt(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_le(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_ge(CIRCLE *circle1, CIRCLE *circle2);
extern bool circle_contain_pt(CIRCLE *circle, Point *point);
extern bool pt_contained_circle(Point *point, CIRCLE *circle);
extern CIRCLE *circle_add_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_sub_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_mul_pt(CIRCLE *circle, Point *point);
extern CIRCLE *circle_div_pt(CIRCLE *circle, Point *point);
extern double *circle_diameter(CIRCLE *circle);
extern double *circle_radius(CIRCLE *circle);
extern double *circle_distance(CIRCLE *circle1, CIRCLE *circle2);
extern double *dist_pc(Point *point, CIRCLE *circle);
extern Datum circle_in(PG_FUNCTION_ARGS);
extern Datum circle_out(PG_FUNCTION_ARGS);
extern Datum circle_same(PG_FUNCTION_ARGS);
extern Datum circle_overlap(PG_FUNCTION_ARGS);
extern Datum circle_overleft(PG_FUNCTION_ARGS);
extern Datum circle_left(PG_FUNCTION_ARGS);
extern Datum circle_right(PG_FUNCTION_ARGS);
extern Datum circle_overright(PG_FUNCTION_ARGS);
extern Datum circle_contained(PG_FUNCTION_ARGS);
extern Datum circle_contain(PG_FUNCTION_ARGS);
extern Datum circle_below(PG_FUNCTION_ARGS);
extern Datum circle_above(PG_FUNCTION_ARGS);
extern Datum circle_eq(PG_FUNCTION_ARGS);
extern Datum circle_ne(PG_FUNCTION_ARGS);
extern Datum circle_lt(PG_FUNCTION_ARGS);
extern Datum circle_gt(PG_FUNCTION_ARGS);
extern Datum circle_le(PG_FUNCTION_ARGS);
extern Datum circle_ge(PG_FUNCTION_ARGS);
extern Datum circle_contain_pt(PG_FUNCTION_ARGS);
extern Datum pt_contained_circle(PG_FUNCTION_ARGS);
extern Datum circle_add_pt(PG_FUNCTION_ARGS);
extern Datum circle_sub_pt(PG_FUNCTION_ARGS);
extern Datum circle_mul_pt(PG_FUNCTION_ARGS);
extern Datum circle_div_pt(PG_FUNCTION_ARGS);
extern Datum circle_diameter(PG_FUNCTION_ARGS);
extern Datum circle_radius(PG_FUNCTION_ARGS);
extern Datum circle_distance(PG_FUNCTION_ARGS);
extern Datum dist_pc(PG_FUNCTION_ARGS);
extern Datum dist_cpoly(PG_FUNCTION_ARGS);
extern Point *circle_center(CIRCLE *circle);
extern CIRCLE *circle(Point *center, float8 *radius);
extern CIRCLE *box_circle(BOX *box);
extern BOX *circle_box(CIRCLE *circle);
extern Datum circle_center(PG_FUNCTION_ARGS);
extern Datum cr_circle(PG_FUNCTION_ARGS);
extern Datum box_circle(PG_FUNCTION_ARGS);
extern Datum circle_box(PG_FUNCTION_ARGS);
extern Datum poly_circle(PG_FUNCTION_ARGS);
extern Datum circle_poly(PG_FUNCTION_ARGS);
/* private routines */
extern double *circle_area(CIRCLE *circle);
extern double circle_dt(CIRCLE *circle1, CIRCLE *circle2);
extern Datum circle_area(PG_FUNCTION_ARGS);
/* support routines for the rtree access method (rtproc.c) */
extern BOX *rt_box_union(BOX *a, BOX *b);
extern BOX *rt_box_inter(BOX *a, BOX *b);
extern void rt_box_size(BOX *a, float *size);
extern void rt_bigbox_size(BOX *a, float *size);
extern Datum rt_box_union(PG_FUNCTION_ARGS);
extern Datum rt_box_inter(PG_FUNCTION_ARGS);
extern Datum rt_box_size(PG_FUNCTION_ARGS);
extern Datum rt_bigbox_size(PG_FUNCTION_ARGS);
extern Datum rt_poly_size(PG_FUNCTION_ARGS);
extern Datum rt_poly_union(PG_FUNCTION_ARGS);
extern Datum rt_poly_inter(PG_FUNCTION_ARGS);

View File

@ -45,7 +45,7 @@ CREATE FUNCTION boxarea(box)
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '_OBJWD_/regress_DLSUFFIX_'
LANGUAGE 'c';
LANGUAGE 'newC';
CREATE FUNCTION reverse_name(name)
RETURNS name

View File

@ -35,7 +35,7 @@ CREATE FUNCTION boxarea(box)
CREATE FUNCTION interpt_pp(path, path)
RETURNS point
AS '_OBJWD_/regress_DLSUFFIX_'
LANGUAGE 'c';
LANGUAGE 'newC';
CREATE FUNCTION reverse_name(name)
RETURNS name
AS '_OBJWD_/regress_DLSUFFIX_'

View File

@ -1,5 +1,5 @@
/*
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.42 2000/07/29 18:46:12 tgl Exp $
* $Header: /cvsroot/pgsql/src/test/regress/regress.c,v 1.43 2000/07/30 20:43:54 tgl Exp $
*/
#include <float.h> /* faked on sunos */
@ -17,10 +17,10 @@
typedef TupleTableSlot *TUPLE;
extern double *regress_dist_ptpath(Point *pt, PATH *path);
extern double *regress_path_dist(PATH *p1, PATH *p2);
extern Datum regress_dist_ptpath(PG_FUNCTION_ARGS);
extern Datum regress_path_dist(PG_FUNCTION_ARGS);
extern PATH *poly2path(POLYGON *poly);
extern Point *interpt_pp(PATH *p1, PATH *p2);
extern Datum interpt_pp(PG_FUNCTION_ARGS);
extern void regress_lseg_construct(LSEG *lseg, Point *pt1, Point *pt2);
extern Datum overpaid(PG_FUNCTION_ARGS);
extern Datum boxarea(PG_FUNCTION_ARGS);
@ -29,24 +29,22 @@ extern char *reverse_name(char *string);
/*
** Distance from a point to a path
*/
double *
regress_dist_ptpath(pt, path)
Point *pt;
PATH *path;
Datum
regress_dist_ptpath(PG_FUNCTION_ARGS)
{
double *result;
double *tmp;
Point *pt = PG_GETARG_POINT_P(0);
PATH *path = PG_GETARG_PATH_P(1);
float8 result = 0.0; /* keep compiler quiet */
float8 tmp;
int i;
LSEG lseg;
switch (path->npts)
{
case 0:
result = palloc(sizeof(double));
*result = Abs((double) DBL_MAX); /* +infinity */
break;
PG_RETURN_NULL();
case 1:
result = point_distance(pt, &path->p[0]);
result = point_dt(pt, &path->p[0]);
break;
default:
@ -55,51 +53,57 @@ PATH *path;
* distance from the point to any of its constituent segments.
*/
Assert(path->npts > 1);
result = palloc(sizeof(double));
for (i = 0; i < path->npts - 1; ++i)
{
regress_lseg_construct(&lseg, &path->p[i], &path->p[i + 1]);
tmp = dist_ps(pt, &lseg);
if (i == 0 || *tmp < *result)
*result = *tmp;
pfree(tmp);
tmp = DatumGetFloat8(DirectFunctionCall2(dist_ps,
PointPGetDatum(pt),
LsegPGetDatum(&lseg)));
if (i == 0 || tmp < result)
result = tmp;
}
break;
}
return result;
PG_RETURN_FLOAT8(result);
}
/* this essentially does a cartesian product of the lsegs in the
two paths, and finds the min distance between any two lsegs */
double *
regress_path_dist(p1, p2)
PATH *p1;
PATH *p2;
Datum
regress_path_dist(PG_FUNCTION_ARGS)
{
double *min,
*tmp;
PATH *p1 = PG_GETARG_PATH_P(0);
PATH *p2 = PG_GETARG_PATH_P(1);
bool have_min = false;
float8 min = 0.0; /* initialize to keep compiler quiet */
float8 tmp;
int i,
j;
LSEG seg1,
seg2;
regress_lseg_construct(&seg1, &p1->p[0], &p1->p[1]);
regress_lseg_construct(&seg2, &p2->p[0], &p2->p[1]);
min = lseg_distance(&seg1, &seg2);
for (i = 0; i < p1->npts - 1; i++)
{
for (j = 0; j < p2->npts - 1; j++)
{
regress_lseg_construct(&seg1, &p1->p[i], &p1->p[i + 1]);
regress_lseg_construct(&seg2, &p2->p[j], &p2->p[j + 1]);
if (*min < *(tmp = lseg_distance(&seg1, &seg2)))
*min = *tmp;
pfree(tmp);
tmp = DatumGetFloat8(DirectFunctionCall2(lseg_distance,
LsegPGetDatum(&seg1),
LsegPGetDatum(&seg2)));
if (!have_min || tmp < min)
{
min = tmp;
have_min = true;
}
}
}
return min;
if (! have_min)
PG_RETURN_NULL();
PG_RETURN_FLOAT8(min);
}
PATH *
@ -124,43 +128,43 @@ POLYGON *poly;
CStringGetDatum(output)));
}
/* return the point where two paths intersect. Assumes that they do. */
Point *
interpt_pp(p1, p2)
PATH *p1;
PATH *p2;
/* return the point where two paths intersect, or NULL if no intersection. */
Datum
interpt_pp(PG_FUNCTION_ARGS)
{
Point *retval;
PATH *p1 = PG_GETARG_PATH_P(0);
PATH *p2 = PG_GETARG_PATH_P(1);
int i,
j;
LSEG seg1,
seg2;
#ifdef NOT_USED
LINE *ln;
#endif
bool found; /* We've found the intersection */
found = false; /* Haven't found it yet */
for (i = 0; i < p1->npts - 1 && !found; i++)
{
regress_lseg_construct(&seg1, &p1->p[i], &p1->p[i + 1]);
for (j = 0; j < p2->npts - 1 && !found; j++)
{
regress_lseg_construct(&seg1, &p1->p[i], &p1->p[i + 1]);
regress_lseg_construct(&seg2, &p2->p[j], &p2->p[j + 1]);
if (lseg_intersect(&seg1, &seg2))
if (DatumGetBool(DirectFunctionCall2(lseg_intersect,
LsegPGetDatum(&seg1),
LsegPGetDatum(&seg2))))
found = true;
}
}
#ifdef NOT_USED
ln = line_construct_pp(&seg2.p[0], &seg2.p[1]);
retval = interpt_sl(&seg1, ln);
#endif
retval = lseg_interpt(&seg1, &seg2);
if (!found)
PG_RETURN_NULL();
return retval;
/* Note: DirectFunctionCall2 will kick out an error if lseg_interpt()
* returns NULL, but that should be impossible since we know the two
* segments intersect.
*/
PG_RETURN_DATUM(DirectFunctionCall2(lseg_interpt,
LsegPGetDatum(&seg1),
LsegPGetDatum(&seg2)));
}