diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-01 19:19:05 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-07-01 19:19:05 +0000 |
commit | e7e1694295e3d867f07afedf6505d0e0436cb67e (patch) | |
tree | bdda7cd092d1c73d0d53820c2a93dd8c2faa4210 /src/backend/utils/adt/geo_ops.c | |
parent | 875efad48170fa9c6ffde98cf8a235470726c692 (diff) | |
download | postgresql-e7e1694295e3d867f07afedf6505d0e0436cb67e.tar.gz postgresql-e7e1694295e3d867f07afedf6505d0e0436cb67e.zip |
Migrate rtree_gist functionality into the core system, and add some
basic regression tests for GiST to the standard regression tests.
I took the opportunity to add an rtree-equivalent gist opclass for
circles; the contrib version only covered boxes and polygons, but
indexing circles is very handy for distance searches.
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r-- | src/backend/utils/adt/geo_ops.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index e2794482633..1786da6dd1c 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.89 2005/06/24 20:53:31 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/geo_ops.c,v 1.90 2005/07/01 19:19:02 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -4605,8 +4605,7 @@ circle_contain(PG_FUNCTION_ARGS) } -/* circle_positionop - - * is circle1 entirely {above,below} circle2? +/* circle_below - is circle1 strictly below circle2? */ Datum circle_below(PG_FUNCTION_ARGS) @@ -4614,18 +4613,46 @@ circle_below(PG_FUNCTION_ARGS) CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); - PG_RETURN_BOOL(FPle(circle1->center.y + circle1->radius, - circle2->center.y - circle2->radius)); + PG_RETURN_BOOL(FPlt((circle1->center.y + circle1->radius), + (circle2->center.y - circle2->radius))); } +/* circle_above - is circle1 strictly above circle2? + */ Datum circle_above(PG_FUNCTION_ARGS) { CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); - PG_RETURN_BOOL(FPge(circle1->center.y - circle1->radius, - circle2->center.y + circle2->radius)); + PG_RETURN_BOOL(FPgt((circle1->center.y - circle1->radius), + (circle2->center.y + circle2->radius))); +} + +/* circle_overbelow - is the upper edge of circle1 at or below + * the upper edge of circle2? + */ +Datum +circle_overbelow(PG_FUNCTION_ARGS) +{ + CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); + CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); + + PG_RETURN_BOOL(FPle((circle1->center.y + circle1->radius), + (circle2->center.y + circle2->radius))); +} + +/* circle_overabove - is the lower edge of circle1 at or above + * the lower edge of circle2? + */ +Datum +circle_overabove(PG_FUNCTION_ARGS) +{ + CIRCLE *circle1 = PG_GETARG_CIRCLE_P(0); + CIRCLE *circle2 = PG_GETARG_CIRCLE_P(1); + + PG_RETURN_BOOL(FPge((circle1->center.y - circle1->radius), + (circle2->center.y - circle2->radius))); } |