wm_elimination bugfixes
This commit is contained in:
parent
0da5f8433c
commit
fae914d2ef
@ -54,7 +54,7 @@ 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_debug where name in (select distinct name from wm_figures);
|
||||||
delete from wm_demo 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, .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';
|
||||||
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, 10, name) from wm_figures where name = 'fig8';
|
||||||
|
|
||||||
|
|
||||||
do $$
|
do $$
|
||||||
|
19
wm.sql
19
wm.sql
@ -392,8 +392,8 @@ begin
|
|||||||
insert into wm_debug (stage, name, gen, nbend, way, props) values(
|
insert into wm_debug (stage, name, gen, nbend, way, props) values(
|
||||||
'ebendattrs',
|
'ebendattrs',
|
||||||
dbgname,
|
dbgname,
|
||||||
i,
|
|
||||||
dbggen,
|
dbggen,
|
||||||
|
i,
|
||||||
bend,
|
bend,
|
||||||
jsonb_build_object(
|
jsonb_build_object(
|
||||||
'area', res.area,
|
'area', res.area,
|
||||||
@ -449,16 +449,23 @@ begin
|
|||||||
continue when bendattrs[i].adjsize >= leftsize;
|
continue when bendattrs[i].adjsize >= leftsize;
|
||||||
continue when bendattrs[i].adjsize >= rightsize;
|
continue when bendattrs[i].adjsize >= rightsize;
|
||||||
|
|
||||||
-- Local minimum. Elminate!
|
-- Local minimum. Elminate bend!
|
||||||
mutated = true;
|
mutated = true;
|
||||||
tmpbendattrs.bend = st_makeline(
|
tmpbendattrs.bend = st_makeline(
|
||||||
st_pointn(bendattrs[i].bend, 1),
|
st_pointn(bendattrs[i].bend, 1),
|
||||||
st_pointn(bendattrs[i].bend, -1)
|
st_pointn(bendattrs[i].bend, -1)
|
||||||
);
|
);
|
||||||
bendattrs[i] = tmpbendattrs;
|
bendattrs[i] = tmpbendattrs;
|
||||||
-- jump over the next bend, because the current bend disappeared,
|
-- remove last vertex of the previous bend and
|
||||||
-- and there is no way the other one can be a "local minima".
|
-- first vertex of the next bend, because bends always
|
||||||
i = i + 1;
|
-- share a line segment together
|
||||||
|
tmpbendattrs.bend = st_removepoint(bendattrs[i-1].bend, st_npoints(bendattrs[i-1].bend)-1);
|
||||||
|
bendattrs[i-1] = tmpbendattrs;
|
||||||
|
tmpbendattrs.bend = st_removepoint(bendattrs[i+1].bend, 0);
|
||||||
|
bendattrs[i+1] = tmpbendattrs;
|
||||||
|
-- the next bend's adjsize is now messed up; it should not be taken
|
||||||
|
-- into consideration for other local minimas. Skip over 2.
|
||||||
|
i = i + 2;
|
||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
if dbgname is not null then
|
if dbgname is not null then
|
||||||
@ -467,7 +474,7 @@ begin
|
|||||||
end loop;
|
end loop;
|
||||||
|
|
||||||
insert into wm_debug(stage, name, gen, nbend, way) values(
|
insert into wm_debug(stage, name, gen, nbend, way) values(
|
||||||
'eelimination',
|
'felimination',
|
||||||
dbgname,
|
dbgname,
|
||||||
dbggen,
|
dbggen,
|
||||||
generate_subscripts(dbgbends, 1),
|
generate_subscripts(dbgbends, 1),
|
||||||
|
Loading…
Reference in New Issue
Block a user