less reliance on test tables

This commit is contained in:
Motiejus Jakštys 2021-04-03 19:03:23 +03:00
parent 102500ea34
commit 6107a50f62
2 changed files with 6 additions and 7 deletions

View File

@ -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)',

View File

@ -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: