diff options
Diffstat (limited to 'embroider.py')
| -rw-r--r-- | embroider.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/embroider.py b/embroider.py index dbf07c1e..09b89d13 100644 --- a/embroider.py +++ b/embroider.py @@ -608,13 +608,14 @@ class AutoFill(Fill): outlines of the holes. """ + # I'd use an intersection check, but floating point errors make it + # fail sometimes. + point = shgeo.Point(*coords) + outlines = list(enumerate(self.shape.boundary)) + closest = min(outlines, key=lambda (index, outline): outline.distance(point)) - for i, outline in enumerate(self.shape.boundary): - # I'd use an intersection check, but floating point errors make it - # fail sometimes. - if outline.distance(point) < 0.00001: - return i + return closest[0] def project(self, coords, outline_index): """project the point onto the specified outline |
