commit 3286890f52b4c48e35064201fe6683e2382624fa (tree)
parent c2c883335cc5cb94cb7269a0af7f97e5647a4fc5
Author: Motiejus Jakštys <motiejus@uber.com>
Date: Fri, 26 Feb 2021 16:12:45 +0200
add safety check
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/IV/wm.sql b/IV/wm.sql
@@ -117,6 +117,9 @@ begin
select geom from st_dumppoints(bends[i]) order by path[1] asc limit 3
) into phead;
+ -- if the bend got too short, stop processing it
+ exit when array_length(phead, 1) < 3;
+
-- if inflection angle between ptail[1:3] "large", stop processing this bend
exit when abs(st_angle(phead[1], phead[2], phead[3]) - pi) > small_angle;