summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/geometry.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py
index 39bbd963..39a1f3fb 100644
--- a/lib/utils/geometry.py
+++ b/lib/utils/geometry.py
@@ -5,6 +5,7 @@
import math
import typing
+from itertools import groupby
import numpy
from shapely.geometry import (GeometryCollection, LinearRing, LineString,
@@ -242,6 +243,11 @@ def offset_points(pos1, pos2, offset_px, offset_proportional):
return out1, out2
+def remove_duplicate_points(path):
+ path = [[round(coord, 4) for coord in point] for point in path]
+ return [point for point, repeats in groupby(path)]
+
+
class Point:
def __init__(self, x: typing.Union[float, numpy.float64], y: typing.Union[float, numpy.float64]):
self.x = float(x)