summaryrefslogtreecommitdiff
path: root/lib/utils/geometry.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/geometry.py')
-rw-r--r--lib/utils/geometry.py6
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]