From 9b619de22807b144373a6166621a7c3002929b2b Mon Sep 17 00:00:00 2001 From: Lex Neva Date: Sat, 15 Sep 2018 21:33:44 -0400 Subject: use faster algorithm for ties --- lib/stitch_plan/stitch.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/stitch_plan/stitch.py') diff --git a/lib/stitch_plan/stitch.py b/lib/stitch_plan/stitch.py index 5fe10fb8..0609dd10 100644 --- a/lib/stitch_plan/stitch.py +++ b/lib/stitch_plan/stitch.py @@ -2,7 +2,7 @@ from ..utils.geometry import Point class Stitch(Point): - def __init__(self, x, y, color=None, jump=False, stop=False, trim=False, color_change=False, fake_color_change=False, no_ties=False): + def __init__(self, x, y=None, color=None, jump=False, stop=False, trim=False, color_change=False, fake_color_change=False, no_ties=False): self.x = x self.y = y self.color = color @@ -13,6 +13,12 @@ class Stitch(Point): self.fake_color_change = fake_color_change self.no_ties = no_ties + # Allow creating a Stitch from a Point + if isinstance(x, Point): + point = x + self.x = point.x + self.y = point.y + def __repr__(self): return "Stitch(%s, %s, %s, %s, %s, %s, %s, %s%s)" % (self.x, self.y, -- cgit v1.2.3