commit 497735d0b1df293b5a204815eadd1b005d4a73d6 (tree)
parent ff777063fb3f6e0a8b3a7aa7bab3956fbe092716
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Fri, 5 Mar 2021 17:49:32 +0200
wip demo self-crossing: it's now incorrectly mutating things
Diffstat:
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git 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
@@ -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;