less reliance on test tables
This commit is contained in:
parent
102500ea34
commit
6107a50f62
@ -104,7 +104,7 @@ declare
|
|||||||
vcrossings geometry[];
|
vcrossings geometry[];
|
||||||
mutated boolean;
|
mutated boolean;
|
||||||
begin
|
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(true, mutated);
|
||||||
perform assert_equals(
|
perform assert_equals(
|
||||||
'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)',
|
'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)
|
) 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(true, mutated);
|
||||||
perform assert_equals(
|
perform assert_equals(
|
||||||
'LINESTRING(84 47,91 59,114 64,120 45,125 39,141 39,147 32)',
|
'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((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(true, mutated);
|
||||||
perform assert_equals(
|
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)',
|
'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)',
|
||||||
|
@ -98,15 +98,13 @@ drop function if exists fix_gentle_inflections1;
|
|||||||
create function fix_gentle_inflections1(INOUT bends geometry[]) as $$
|
create function fix_gentle_inflections1(INOUT bends geometry[]) as $$
|
||||||
declare
|
declare
|
||||||
pi constant real default radians(180);
|
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
|
ptail geometry; -- tail point of tail bend
|
||||||
phead geometry[]; -- 3 tail points of head bend
|
phead geometry[]; -- 3 tail points of head bend
|
||||||
i int4; -- bends[i] is the current head
|
i int4; -- bends[i] is the current head
|
||||||
begin
|
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
|
for i in 2..array_length(bends, 1) loop
|
||||||
-- Predicate: two bends will always share an edge. Assuming (A,B,C,D,E,F)
|
-- Predicate: two bends will always share an edge. Assuming (A,B,C,D,E,F)
|
||||||
-- is a bend:
|
-- is a bend:
|
||||||
|
Loading…
Reference in New Issue
Block a user