diff --git a/notes.txt b/notes.txt index 1b7803f..761e3d8 100644 --- a/notes.txt +++ b/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/wm.sql b/wm.sql index 52a257e..d987d63 100644 --- a/wm.sql +++ b/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;