From d71b8dbcc96553796c1d6ae0cb6673445cf405ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Sat, 1 May 2021 14:17:55 +0300 Subject: [PATCH] retain zero-sized bends --- IV/tests.sql | 4 ++-- IV/wm.sql | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/IV/tests.sql b/IV/tests.sql index c7103f0..33fc541 100644 --- a/IV/tests.sql +++ b/IV/tests.sql @@ -53,8 +53,8 @@ insert into wm_figures (name, way) values ('selfcrossing-1-rev',ST_Reverse(ST_Tr delete from wm_debug where name in (select distinct name from wm_figures); delete from wm_demo where name in (select distinct name from wm_figures); -insert into wm_demo (name, way) select name, ST_SimplifyWM(way, 10000, name) from wm_figures where name != 'fig8'; -insert into wm_demo (name, way) select name, ST_SimplifyWM(way, 15, name) from wm_figures where name = 'fig8'; +insert into wm_demo (name, way) select name, ST_SimplifyWM(way, .1, name) from wm_figures where name != 'fig8'; +insert into wm_demo (name, way) select name, ST_SimplifyWM(way, .1, name) from wm_figures where name = 'fig8'; do $$ diff --git a/IV/wm.sql b/IV/wm.sql index 3606a11..8cc5e2f 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -431,7 +431,8 @@ begin i = 1; while i < array_length(bendattrs, 1)-1 loop i = i + 1; - continue when area_threshold >= bendattrs[i].adjsize; + continue when bendattrs[i].adjsize = 0; + continue when bendattrs[i].adjsize > area_threshold; if i = 2 then leftsize = bendattrs[i].adjsize + 1; @@ -445,8 +446,8 @@ begin rightsize = bendattrs[i+1].adjsize; end if; - continue when leftsize <= bendattrs[i].adjsize; - continue when rightsize <= bendattrs[i].adjsize; + continue when bendattrs[i].adjsize >= leftsize; + continue when bendattrs[i].adjsize >= rightsize; -- Local minimum. Elminate! mutated = true;