summaryrefslogtreecommitdiff
path: root/lib/stitch_plan
diff options
context:
space:
mode:
authorGeorge Steel <george.steel@gmail.com>2022-12-26 20:13:48 -0500
committerGeorge Steel <george.steel@gmail.com>2022-12-26 20:13:48 -0500
commite28ea888a9604052d6d7b94c8e29e34b74242994 (patch)
treed9c20a8b56aca08791cde310e47a0a562c5ad97b /lib/stitch_plan
parentb63f19b2d0747769c60c8a2a52489ee30fa02a07 (diff)
use random oracle for randomized satin columns and redo split stitches
Diffstat (limited to 'lib/stitch_plan')
-rw-r--r--lib/stitch_plan/stitch.py11
-rw-r--r--lib/stitch_plan/stitch_group.py8
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/stitch_plan/stitch.py b/lib/stitch_plan/stitch.py
index 0d46b85d..3bfa7075 100644
--- a/lib/stitch_plan/stitch.py
+++ b/lib/stitch_plan/stitch.py
@@ -4,6 +4,7 @@
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
from ..utils.geometry import Point
+from shapely import geometry as shgeo
class Stitch(Point):
@@ -17,13 +18,13 @@ class Stitch(Point):
# Allow creating a Stitch from another Stitch. Attributes passed as
# arguments will override any existing attributes.
base_stitch = x
- self.x = base_stitch.x
- self.y = base_stitch.y
- elif isinstance(x, Point):
+ self.x: float = base_stitch.x
+ self.y: float = base_stitch.y
+ elif isinstance(x, (Point, shgeo.Point)):
# Allow creating a Stitch from a Point
point = x
- self.x = point.x
- self.y = point.y
+ self.x: float = point.x
+ self.y: float = point.y
else:
Point.__init__(self, x, y)
diff --git a/lib/stitch_plan/stitch_group.py b/lib/stitch_plan/stitch_group.py
index 21beebe1..6dbeb9e5 100644
--- a/lib/stitch_plan/stitch_group.py
+++ b/lib/stitch_plan/stitch_group.py
@@ -43,14 +43,14 @@ class StitchGroup:
# This method allows `len(patch)` and `if patch:
return len(self.stitches)
- def add_stitches(self, stitches):
+ def add_stitches(self, stitches, tags=None):
for stitch in stitches:
- self.add_stitch(stitch)
+ self.add_stitch(stitch, tags=tags)
- def add_stitch(self, stitch):
+ def add_stitch(self, stitch, tags=None):
if not isinstance(stitch, Stitch):
# probably a Point
- stitch = Stitch(stitch)
+ stitch = Stitch(stitch, tags=tags)
self.stitches.append(stitch)