commit 6107a50f62181c217f1543cc0fce531a6b81fa02 (tree)
parent 102500ea34b52d55abc59a0f48e6860564bbe0e3
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Sat, 3 Apr 2021 19:03:23 +0300
less reliance on test tables
Diffstat:
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/IV/tests.sql b/IV/tests.sql
@@ -104,7 +104,7 @@ declare
vcrossings geometry[];
mutated boolean;
begin
- select (self_crossing((select ways from inflections where name='fig6'))).* into vcrossings, mutated;
+ select (self_crossing(array((select way from debug_wm where stage='cinflections' and dbgname='fig6')))).* into vcrossings, mutated;
perform assert_equals(true, mutated);
perform assert_equals(
'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)',
@@ -113,7 +113,7 @@ begin
) from (select unnest(vcrossings) way) a)
);
- select (self_crossing((select ways from inflections where name='fig6-rev'))).* into vcrossings, mutated;
+ select (self_crossing(array((select way from debug_wm where stage='cinflections' and dbgname='fig6-rev')))).* into vcrossings, mutated;
perform assert_equals(true, mutated);
perform assert_equals(
'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)',
@@ -123,6 +123,7 @@ begin
);
select (self_crossing((select ways from inflections where name='fig6-combi'))).* into vcrossings, mutated;
+ --select (self_crossing(array((select way from debug_wm where stage='cinflections' and dbgname='fig6-combi')))).* into vcrossings, mutated;
perform assert_equals(true, mutated);
perform assert_equals(
'LINESTRING(84 137,91 149,114 154,120 135,125 129,141 129,147 122,164 137,171 149,194 154,200 135,205 129,221 129,227 122)',
diff --git a/IV/wm.sql b/IV/wm.sql
@@ -98,15 +98,13 @@ drop function if exists fix_gentle_inflections1;
create function fix_gentle_inflections1(INOUT bends geometry[]) as $$
declare
pi constant real default radians(180);
- small_angle real;
+ -- the threshold when the angle is still "small", so gentle inflections can
+ -- be joined
+ small_angle constant real default radians(30);
ptail geometry; -- tail point of tail bend
phead geometry[]; -- 3 tail points of head bend
i int4; -- bends[i] is the current head
begin
- -- the threshold when the angle is still "small", so gentle inflections can
- -- be joined
- small_angle := radians(30);
-
for i in 2..array_length(bends, 1) loop
-- Predicate: two bends will always share an edge. Assuming (A,B,C,D,E,F)
-- is a bend: