basictypes: Point: Added Eucledian distance from another point.
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
1474e7e03a
commit
44ae995c2d
@ -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):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user