diff options
| author | George Steel <george.steel@gmail.com> | 2023-01-29 21:42:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-29 21:42:30 -0500 |
| commit | a2c6d5fbcbbfaffb0604705c5530310649a8db82 (patch) | |
| tree | 7aedd594a9fe5f25c9e5aa8078c7b91ebcd90a54 /lib/utils/geometry.py | |
| parent | 73b1fc17cdf3cb1c2477bb0f90b080f52bf4b327 (diff) | |
| parent | 581ecd486999045625995db031e2dc7d55bbe907 (diff) | |
Merge pull request #2027 from inkstitch/george-steel/fix-running-stitch
Replace running stitch algorithm to give consistent stitch lengths
Diffstat (limited to 'lib/utils/geometry.py')
| -rw-r--r-- | lib/utils/geometry.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py index 0ca13d8f..789f8720 100644 --- a/lib/utils/geometry.py +++ b/lib/utils/geometry.py @@ -211,6 +211,9 @@ class Point: def unit(self): return self.mul(1.0 / self.length()) + def angle(self): + return math.atan2(self.y, self.x) + def rotate_left(self): return self.__class__(-self.y, self.x) @@ -229,6 +232,9 @@ class Point: def __len__(self): return 2 + def __str__(self): + return "({0:.3f}, {1:.3f})".format(self.x, self.y) + def line_string_to_point_list(line_string): return [Point(*point) for point in line_string.coords] |
