From 76dee76b31883f55d4d27702cb3d84473ae9bf58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 13 May 2021 22:06:27 +0300 Subject: [PATCH] check more carefully for intersections --- IV/visuals.sql | 3 +-- IV/wm.sql | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IV/visuals.sql b/IV/visuals.sql index f841b8f..7a4f584 100644 --- a/IV/visuals.sql +++ b/IV/visuals.sql @@ -125,8 +125,7 @@ begin ('salvis-visvalingam-' || i, geom2), ('salvis-visvalingam-' || i || '-chaikin', st_chaikinsmoothing(geom2, 5)); end loop; - --foreach i in array array[75, 375] loop - foreach i in array array[75] loop + foreach i in array array[75, 375] loop geom3 = st_simplifywm((select way from wm_visuals where name='salvis'), i, 50, 'salvis-wm-' || i); insert into wm_visuals(name, way) values ('salvis-wm-' || i, geom3); diff --git a/IV/wm.sql b/IV/wm.sql index 0cb940b..ae0d7f1 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -531,12 +531,20 @@ begin continue when st_intersects(bend, st_removepoint(st_removepoint(bends[i-1], n-1), n-2)); end if; + if n > 2 then + tmpint = st_intersection(bend, st_removepoint(bends[i-1], n-1)); + continue when st_npoints(tmpint) > 1; + end if; n = st_npoints(bends[i+1]); if n > 3 then continue when st_intersects(bend, st_removepoint(st_removepoint(bends[i+1], 0), 0)); end if; + if n > 2 then + tmpint = st_intersection(bend, st_removepoint(bends[i+1], 0)); + continue when st_npoints(tmpint) > 1; + end if; for n in -intersect_patience+1..intersect_patience-1 loop continue when n in (-1, 0, 1); @@ -727,7 +735,6 @@ begin mutated = true; gen = 1; - raise notice 'dbgname: %, gen: %', dbgname, gen; while mutated loop if dbgname is not null then insert into wm_debug (stage, name, gen, nbend, way) values(