From 2fde596272b339ebb9b63ceebd66c5e7a0c641f2 Mon Sep 17 00:00:00 2001 From: Kaalleen <36401965+kaalleen@users.noreply.github.com> Date: Fri, 10 Jun 2022 16:25:30 +0200 Subject: Guided ripple stitch (#1675) Co-authored-by: @lexelby --- lib/utils/geometry.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/utils/geometry.py') 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) -- cgit v1.2.3