From ffc0db1ddf2f790fecaa67cdacec87f207e999e8 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Sat, 19 Jul 2025 22:30:15 +0200 Subject: Convert to satin internally (3874) --- lib/utils/geometry.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/utils') 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) -- cgit v1.2.3