basictypes: Point: Added Eucledian distance from another point.

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2022-01-30 18:39:31 +03:00
parent 1474e7e03a
commit 44ae995c2d
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -35,6 +35,11 @@ class Point:
def apply_cartesian_shift(self, x, y) -> None: def apply_cartesian_shift(self, x, y) -> None:
pass pass
def distance_from_point(self, point) -> float:
# Euclidian distance
distance = math.sqrt((self.get_x() - point.get_x())**2 + (self.get_y() - point.get_y())**2)
return distance
class PointWithID(Point): class PointWithID(Point):