Commit 5e9a0cad authored by Darafei Praliaskouski's avatar Darafei Praliaskouski

ST_Subdivide endless loop on coordinates near coincident to bounds

Closes #4301
Closes https://github.com/postgis/postgis/pull/361



git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17164 b70326c6-7e19-0410-871a-916f4a2858ee
parent a53fb7cd
Pipeline #43714538 passed with stage
in 22 minutes and 11 seconds
......@@ -28,8 +28,13 @@ XXXX/XX/XX
- #4273, Tighter parsing of WKT (Paul Ramsey)
- #4292, ST_AsMVT: parse JSON numeric values with decimals as doubles (Raúl Marín)
- #4300, ST_AsMVTGeom: Always return the simplest geometry (Raúl Marín)
- #4301, ST_Subdivide: fix endless loop on coordinates near coincident to bounds
(Darafei Praliaskouski)
PostGIS 2.5.1
2018/11/18
......
......@@ -2392,9 +2392,19 @@ lwgeom_subdivide_recursive(const LWGEOM *geom, uint8_t dimension, uint32_t maxve
if (pivot == DBL_MAX) pivot = center;
if (split_ordinate == 0)
subbox1.xmax = subbox2.xmin = pivot;
{
if (FP_NEQUALS(subbox1.xmax, pivot) && FP_NEQUALS(subbox1.xmin, pivot))
subbox1.xmax = subbox2.xmin = pivot;
else
subbox1.xmax = subbox2.xmin = center;
}
else
subbox1.ymax = subbox2.ymin = pivot;
{
if (FP_NEQUALS(subbox1.ymax, pivot) && FP_NEQUALS(subbox1.ymin, pivot))
subbox1.ymax = subbox2.ymin = pivot;
else
subbox1.ymax = subbox2.ymin = center;
}
++depth;
......
This diff is collapsed.
......@@ -7,3 +7,4 @@ ERROR: lwgeom_subdivide: cannot subdivide to fewer than 5 vertices per output
4|29321996468.6|29321996468.6|1857|256
#4211|0.00008316000
#4217|0.00002463668
#4301|0.00213614552
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment