From b9063c49f338f9fef6edc1f6e13e47d34a52f444 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Thu, 26 Apr 2012 16:30:18 +0000 Subject: [PATCH] Give ST_Azimuth a chance with close but distinct points (#1791) git-svn-id: http://svn.osgeo.org/postgis/trunk@9682 b70326c6-7e19-0410-871a-916f4a2858ee --- NEWS | 1 + postgis/lwgeom_functions_basic.c | 2 +- regress/tickets.sql | 7 +++++++ regress/tickets_expected | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4b27a5fd6..793e362fb 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ PostGIS 2.0.1 * Bug Fixes * + - #1791, fix ST_Azimuth with very close but distinct points. - #1775, ST_ChangeEdgeGeom collision detection with 2-vertex target. - #1776, fix ST_SymDifference(empty, geom) to return geom. - #1708, improve restore of PosgreSQL 9.1 backups. diff --git a/postgis/lwgeom_functions_basic.c b/postgis/lwgeom_functions_basic.c index 796675fc6..5a3398f17 100644 --- a/postgis/lwgeom_functions_basic.c +++ b/postgis/lwgeom_functions_basic.c @@ -2376,7 +2376,7 @@ Datum LWGEOM_azimuth(PG_FUNCTION_ARGS) PG_FREE_IF_COPY(geom, 1); /* Standard return value for equality case */ - if ( FP_EQUALS(p1.x, p2.x) && FP_EQUALS(p1.y, p2.y) ) + if ( (p1.x == p2.x) && (p1.y == p2.y) ) { PG_RETURN_NULL(); } diff --git a/regress/tickets.sql b/regress/tickets.sql index 879e45f97..c2e23050f 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -670,5 +670,12 @@ SELECT '#1776', ST_AsText(ST_SymDifference(A,B)), ST_AsText(ST_SymDifference(B, A)) FROM inp; +-- #1791 -- +with inp as ( SELECT + '010100000000000000004065C0041AD965BE5554C0'::geometry as a, + '010100000001000000004065C0041AD965BE5554C0'::geometry as b +) SELECT '#1791', round(ST_Azimuth(a,b)*10)/10 from inp; + + -- Clean up DELETE FROM spatial_ref_sys; diff --git a/regress/tickets_expected b/regress/tickets_expected index 24060f7c8..a70f86f03 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -218,3 +218,4 @@ NOTICE: SRID value -1 converted to the officially unknown SRID value 0 #1734.1|1026 #1755|01010000A0E6100000000000000040554000000000008041400000000000000000 #1776|POLYGON((0 0,10 0,10 10,0 0))|POLYGON((0 0,10 0,10 10,0 0)) +#1791|4.7 -- 2.40.0