commit b800fd308c773970127ad5d9bbb1e9fd2df6c545 (tree)
parent 485e7b1512f30bd6651d41a6fdc3327816f188a9
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Mon, 1 Mar 2021 10:22:40 +0200
add some notes about self-line-crossing
Diffstat:
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/IV/notes.txt b/IV/notes.txt
@@ -1 +1,36 @@
-Definition of a bend: ends of the line should always be bends, otherwise not all line vertices are covered by bends (definition elsewhere).
+Definition of a bend: ends of the line should always be bends, otherwise not
+all line vertices are covered by bends (definition elsewhere).
+
+Gentle inflection at the end of the bend: the article does not specify how many
+vertices should be included when calculating the end-of-bend inflection. We
+chose the iterative approach -- as long as the angle is "right" and the
+distance is (greedily) decreasing, keep going.
+
+Self-line crossing when cutting a bend: the self-line-crossing may happen
+after a few bends have been skipped. E.g. ends of A<->B cross the line, but
+"swallow" a few more in between:
+
+ ,______
+ / \
+ |___A | \ |
+ \ | B\ | __
+ \ | | | / \
+ / | | |___,---,___/A |
+ / | \_________________|
+ \ |
+ \ |
+ / /
+ ----/ /
+ / ,____/
+/ B|
+ |
+
+If a bend with 180+ deg inflection is found, its line between inflection angles
+(AB in our examples) must be crossed with all the other bends to detect a
+possible line-crossing. This is O(N*M), where N is the total number of line
+segments, and M is the number of qualifying bends. In other words, can be very
+computationally expensive.
+
+This may be slightly computationally simplified: if other bend's
+endpoints (A' and B') are in different sub-planes as divided by AB, then the
+crossing exists, and more expensive st_split can be used.
diff --git a/IV/wm.sql b/IV/wm.sql
@@ -164,3 +164,15 @@ begin
end loop;
end
$$ language plpgsql;
+
+-- self_crossing eliminates self-crossing from the bends, following the
+-- article's section "Self-line Crossing When Cutting a Bend".
+create or replace function self_crossing(INOUT bends geometry[]) as $$
+declare
+ pi real;
+begin
+
+
+
+end
+$$ language plpgsql;