diff options
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
| -rw-r--r-- | src/backend/utils/adt/geo_ops.c | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/src/backend/utils/adt/geo_ops.c b/src/backend/utils/adt/geo_ops.c index 4dacd09f1c..1be8577a2d 100644 --- a/src/backend/utils/adt/geo_ops.c +++ b/src/backend/utils/adt/geo_ops.c @@ -7,7 +7,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.3 1997/04/22 17:31:32 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.4 1997/04/25 18:40:25 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -2675,7 +2675,7 @@ poly_path(POLYGON *poly) * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.3 1997/04/22 17:31:32 scrappy Exp $ + * $Header: /cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v 1.4 1997/04/25 18:40:25 scrappy Exp $ * *------------------------------------------------------------------------- */ @@ -3075,18 +3075,35 @@ double *circle_radius(CIRCLE *circle) } -/* circle_distance - returns the distance between the - * center points of two circlees. +/* circle_distance - returns the distance between + * two circles. */ double *circle_distance(CIRCLE *circle1, CIRCLE *circle2) { double *result; result = PALLOCTYPE(double); - *result = point_dt(&circle1->center,&circle2->center); + *result = (point_dt(&circle1->center,&circle2->center) + - (circle1->radius + circle2->radius)); + if (*result < 0) *result = 0; return(result); -} +} /* circle_distance() */ + + +/* dist_pc - returns the distance between + * a point and a circle. + */ +double *dist_pc(Point *point, CIRCLE *circle) +{ + double *result; + + result = PALLOCTYPE(double); + *result = (point_dt(point,&circle->center) - circle->radius); + if (*result < 0) *result = 0; + + return(result); +} /* dist_pc() */ /* circle_center - returns the center point of the circle. |
