summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/geo_ops.c
diff options
context:
space:
mode:
authorMarc G. Fournier <scrappy@hub.org>1997-04-25 18:40:50 +0000
committerMarc G. Fournier <scrappy@hub.org>1997-04-25 18:40:50 +0000
commit094ec2d3f3d31a4dcd14945e8b0a3667c3103f0d (patch)
tree81e80a25191afa235fb74b901f96615dbf1aabbf /src/backend/utils/adt/geo_ops.c
parentb8e376ceb9a72c8d132e21699f11fe2b36b8c68c (diff)
downloadpostgresql-094ec2d3f3d31a4dcd14945e8b0a3667c3103f0d.tar.gz
More timezone patches by Thomas:
Here are patches which should help fix timezone problems in the datetime and abstime code. Also, I repatched varlena.c to add in some comments and a little error checking on top of Vadim's earlier repairs. There are slight mods to the circle data type to have the distance operator between circles measure the distance between closest points rather than between centers.
Diffstat (limited to 'src/backend/utils/adt/geo_ops.c')
-rw-r--r--src/backend/utils/adt/geo_ops.c29
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.