diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2022-06-10 16:25:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-10 16:25:30 +0200 |
| commit | 2fde596272b339ebb9b63ceebd66c5e7a0c641f2 (patch) | |
| tree | 8beb5a62880fc66026551fca7fe4676de456029a /lib/utils/geometry.py | |
| parent | 68deec88a8a8c4e469191d8c00641a1077c2508a (diff) | |
Guided ripple stitch (#1675)
Co-authored-by: @lexelby
Diffstat (limited to 'lib/utils/geometry.py')
| -rw-r--r-- | lib/utils/geometry.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/utils/geometry.py b/lib/utils/geometry.py index 86205f02..8d29ddb0 100644 --- a/lib/utils/geometry.py +++ b/lib/utils/geometry.py @@ -125,6 +125,10 @@ class Point: self.x = x self.y = y + @classmethod + def from_shapely_point(cls, point): + return cls(point.x, point.y) + def __json__(self): return vars(self) @@ -155,12 +159,15 @@ class Point: else: raise ValueError("cannot multiply %s by %s" % (type(self), type(other))) - def __div__(self, other): + def __truediv__(self, other): if isinstance(other, (int, float)): return self * (1.0 / other) else: raise ValueError("cannot divide %s by %s" % (type(self), type(other))) + def __eq__(self, other): + return self.x == other.x and self.y == other.y + def __repr__(self): return "%s(%s,%s)" % (type(self), self.x, self.y) |
