stud

study spacejunk
Log | Files | Refs | LICENSE

commit 0232080fb5fd6fe632824dfa8337d381cd57d11c (tree)
parent 58d3068a3b617744b82b8e92981e7c679b111787
Author: Motiejus Jakštys <motiejus@uber.com>
Date:   Fri, 26 Feb 2021 19:21:20 +0200

clean up debugging and test output

Diffstat:
MIV/tests.sql | 5++---
MIV/wm.sql | 4----
2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/IV/tests.sql b/IV/tests.sql @@ -18,14 +18,13 @@ insert into figures (name, way) values ('fig3-1',ST_GeomFromText('LINESTRING(0 0 insert into figures (name, way) values ('fig5',ST_GeomFromText('LINESTRING(0 39,19 52,27 77,26 104,41 115,49 115,65 103,65 75,53 45,63 15,91 0)')); insert into figures (name, way) values ('inflection-1',ST_GeomFromText('LINESTRING(110 24,114 20,133 20,145 15,145 0,136 5,123 7,114 7,111 2)')); --- tables are for manual inspection using, say, qgis +-- DETECT BENDS drop table if exists bends; create table bends (name text, way geometry); insert into bends select 'fig3', unnest(detect_bends((select way from figures where name='fig3'))); insert into bends select 'fig5', unnest(detect_bends((select way from figures where name='fig5'))); insert into bends select 'inflection-1', unnest(detect_bends((select way from figures where name='inflection-1'))); --- DETECT BENDS do $$ declare vbends geometry[]; @@ -41,13 +40,13 @@ begin perform assert_equals(3, array_length(vbends, 1)); end $$ language plpgsql; +-- FIX BEND INFLECTIONS drop table if exists inflections; create table inflections (name text, way geometry); insert into inflections select 'fig3', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='fig3')))); insert into inflections select 'fig5', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='fig5')))); insert into inflections select 'inflection-1', unnest(fix_gentle_inflections(detect_bends((select way from figures where name='inflection-1')))); --- FIX BEND INFLECTIONS do $$ declare vbends geometry[]; diff --git a/IV/wm.sql b/IV/wm.sql @@ -148,19 +148,15 @@ begin -- if inflection angle between ptail[1:3] "large", stop processing this bend if abs(st_angle(phead[1], phead[2], phead[3]) - pi) > small_angle then - --raise notice 'quitting % because angle between % % %', st_astext(ptail), st_astext(phead[1]), st_astext(phead[2]), st_astext(phead[3]); exit; end if; -- distance from head's first vertex should be larger than from second vertex if st_distance(ptail, phead[2]) < st_distance(ptail, phead[3]) then - --raise notice 'quitting % because distance', st_astext(ptail); exit; end if; -- detected a gentle inflection. Move head of the tail to the tail of head - --raise notice 'fixing a gentle inflection of angle %', degrees(abs(st_angle(phead[1], phead[2], phead[3]) - pi)); - bends[i] = st_removepoint(bends[i], 0); bends[i-1] = st_addpoint(bends[i-1], phead[3]); end loop;