From 3a45bd98266cbf945a006880f8e71c5d9dcc8c24 Mon Sep 17 00:00:00 2001 From: XANTRONIX Industrial Date: Mon, 24 Mar 2025 14:16:32 -0400 Subject: [PATCH] Incremental improvements --- lib/xmet/geo.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/xmet/geo.py b/lib/xmet/geo.py index 1598fde..3834a2d 100644 --- a/lib/xmet/geo.py +++ b/lib/xmet/geo.py @@ -119,7 +119,7 @@ class PolygonBuilder(): if direction is not PointDirection.LEFT: return - for i in range(i1, i2+1): + for i in range(i1+1, i2): yield from self.yield_point(self.bounds[i % count]) def each_point_within(self): @@ -184,6 +184,19 @@ class PolygonBuilder(): last = point + # + # If the first point is to the right of the last point, fill in the + # intermediates. + # + i1 = self.bounds.nearest_index(self.point_first) + i2 = self.bounds.nearest_index(self.point_last) + + dist, direction = self.bounds.index_distance(i1, i2) + + if direction is PointDirection.RIGHT: + yield from self.each_intermediate_point(self.point_last, + self.point_first) + def process(self) -> shapely.Polygon: pass