[postgis-tickets] r16421 - Use more precise bounds when testing overlap of temporal ranges.
Darafei "Komяpa" Praliaskouski
me at komzpa.net
Mon Feb 26 10:32:39 PST 2018
Can the original query be added to regress.sql, at least in trunk?
пн, 26 февр. 2018 г. в 21:27, Paul Ramsey <pramsey at cleverelephant.ca>:
> Author: pramsey
> Date: 2018-02-26 10:27:03 -0800 (Mon, 26 Feb 2018)
> New Revision: 16421
>
> Modified:
> branches/2.3/NEWS
> branches/2.3/liblwgeom/lwlinearreferencing.c
> Log:
> Use more precise bounds when testing overlap of temporal ranges.
> For 2.3, references #4025
>
>
> Modified: branches/2.3/NEWS
> ===================================================================
> --- branches/2.3/NEWS 2018-02-26 18:25:45 UTC (rev 16420)
> +++ branches/2.3/NEWS 2018-02-26 18:27:03 UTC (rev 16421)
> @@ -7,6 +7,7 @@
> - #4003, lwpoly_construct_circle: Avoid division by zero (Raúl Marín
> Rodríguez)
> - #4020, Casting from box3d to geometry now returns correctly connected
> PolyhedralSurface (Matthias Bay)
> + - #4025, Incorrect answers for temporally "amost overlapping" ranges
>
> PostGIS 2.3.6
> 2018/01/17
>
> Modified: branches/2.3/liblwgeom/lwlinearreferencing.c
> ===================================================================
> --- branches/2.3/liblwgeom/lwlinearreferencing.c 2018-02-26
> 18:25:45 UTC (rev 16420)
> +++ branches/2.3/liblwgeom/lwlinearreferencing.c 2018-02-26
> 18:27:03 UTC (rev 16421)
> @@ -1073,7 +1073,7 @@
> {
> LWLINE *l1, *l2;
> int i;
> - const GBOX *gbox1, *gbox2;
> + GBOX gbox1, gbox2;
> double tmin, tmax;
> double *mvals;
> int nmvals = 0;
> @@ -1101,20 +1101,19 @@
> return -1;
> }
>
> - /* 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 )
> {
>
> _______________________________________________
> postgis-tickets mailing list
> postgis-tickets at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-tickets
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-tickets/attachments/20180226/86d8cb67/attachment.html>
More information about the postgis-tickets
mailing list