diff options
| author | George Steel <george.steel@gmail.com> | 2023-01-22 03:05:51 -0500 |
|---|---|---|
| committer | George Steel <george.steel@gmail.com> | 2023-01-22 03:06:01 -0500 |
| commit | 9ca70886513b1d91bcdb7276bc8bc7b24ebc6091 (patch) | |
| tree | 72adf7cb19ac7583838c268c2174cb65ba106c02 /lib/utils/geometry.py | |
| parent | a5c085f390109a97e39573bcd3906e2cf588a6de (diff) | |
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] |
