From 497735d0b1df293b5a204815eadd1b005d4a73d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Fri, 5 Mar 2021 17:49:32 +0200 Subject: [PATCH] wip demo self-crossing: it's now incorrectly mutating things --- IV/notes.txt | 8 +++++++- IV/wm.sql | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/IV/notes.txt b/IV/notes.txt index 1b7803f..761e3d8 100644 --- a/IV/notes.txt +++ b/IV/notes.txt @@ -48,12 +48,18 @@ but they will be eliminated by joining A and B anyway. Also, there is another way to remove self-crossing, without removing most of the bend. E.g. from: - \ \ + \ / B\ | __ | | / \ | |____/A | \__________| +Instead of: + + \ / + \/ A' + B + To: \ \_ diff --git a/IV/wm.sql b/IV/wm.sql index 52a257e..d987d63 100644 --- a/IV/wm.sql +++ b/IV/wm.sql @@ -234,6 +234,14 @@ begin -- bends[i] = append(bends[i], multi[2][2..n]) -- remove bends from bends[i+1] to bends[j] inclusive. + if j < i then + bends[j] = st_geometryn(multi, 1); + bends[j] = st_setpoint(bends[j], st_npoints(bends[j])-1, st_pointn(bends[i], st_npoints(bends[i]))); + bends = bends[1:j] || bends[i+1:array_length(bends, 1)]; + else + -- + end if; + end loop; end loop;