[postgis-tickets] r16500 - ST_CPAWithin precision fix
Darafei
komzpa at gmail.com
Tue Mar 27 10:36:47 PDT 2018
Author: komzpa
Date: 2018-03-27 10:36:47 -0700 (Tue, 27 Mar 2018)
New Revision: 16500
Modified:
branches/2.4/NEWS
branches/2.4/liblwgeom/lwlinearreferencing.c
Log:
ST_CPAWithin precision fix
Closes #4032
Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS 2018-03-27 17:31:51 UTC (rev 16499)
+++ branches/2.4/NEWS 2018-03-27 17:36:47 UTC (rev 16500)
@@ -12,17 +12,17 @@
- #4017, lwgeom lexer memory corruption (Peter E)
- #4020, Casting from box3d to geometry now returns correctly connected
PolyhedralSurface (Matthias Bay)
- - #4025, Incorrect answers for temporally "almost overlapping" ranges
+ - #4025, #4032 Incorrect answers for temporally "almost overlapping" ranges
+ (Paul Ramsey, Darafei Praliaskouski)
- #4052, schema qualify several functions in geography (Regina Obe)
- #4055, ST_ClusterIntersecting drops SRID (Daniel Baston)
* Enhancements *
- - #3946, Compile support for PgSQL 11 (Paul Ramsey)
- - #3992, Use PKG_PROG_PKG_CONFIG macro from pkg.m4 to detect pkg-config
- (Bas Couwenberg)
- - #4044, Upgrade support for PgSQL 11 (Regina Obe)
+ - #3946, Compile support for PgSQL 11 (Paul Ramsey)
+ - #3992, Use PKG_PROG_PKG_CONFIG macro from pkg.m4 to detect pkg-config
+ (Bas Couwenberg)
+ - #4044, Upgrade support for PgSQL 11 (Regina Obe)
-
PostGIS 2.4.3
2018/01/17
Modified: branches/2.4/liblwgeom/lwlinearreferencing.c
===================================================================
--- branches/2.4/liblwgeom/lwlinearreferencing.c 2018-03-27 17:31:51 UTC (rev 16499)
+++ branches/2.4/liblwgeom/lwlinearreferencing.c 2018-03-27 17:36:47 UTC (rev 16500)
@@ -23,7 +23,6 @@
*
**********************************************************************/
-
#include "liblwgeom_internal.h"
#include "lwgeom_log.h"
#include "measures3d.h"
@@ -1239,7 +1238,7 @@
{
LWLINE *l1, *l2;
int i;
- const GBOX *gbox1, *gbox2;
+ GBOX gbox1, gbox2;
double tmin, tmax;
double *mvals;
int nmvals = 0;
@@ -1268,20 +1267,19 @@
return LW_FALSE;
}
- /* WARNING: these ranges may be wider than real ones */
- gbox1 = lwgeom_get_bbox(g1);
- gbox2 = lwgeom_get_bbox(g2);
+ /* We use lwgeom_calculate_gbox() instead of lwgeom_get_gbox() */
+ /* because we cannot afford the float rounding inaccuracy when */
+ /* we compare the ranges for overlap below */
+ lwgeom_calculate_gbox(g1, &gbox1);
+ lwgeom_calculate_gbox(g2, &gbox2);
- assert(gbox1); /* or the npoints check above would have failed */
- assert(gbox2); /* or the npoints check above would have failed */
-
/*
* Find overlapping M range
* WARNING: may be larger than the real one
*/
- tmin = FP_MAX(gbox1->mmin, gbox2->mmin);
- tmax = FP_MIN(gbox1->mmax, gbox2->mmax);
+ tmin = FP_MAX(gbox1.mmin, gbox2.mmin);
+ tmax = FP_MIN(gbox1.mmax, gbox2.mmax);
if ( tmax < tmin )
{
@@ -1289,8 +1287,6 @@
return LW_FALSE;
}
- // lwnotice("Min:%g, Max:%g", tmin, tmax);
-
/*
* Collect M values in common time range from inputs
*/
More information about the postgis-tickets
mailing list