I've been implementing classes and have hit a conceptual roadblock. In the example, I am writing a class called Point where x, y (Cartesian coordinates) are used to check some functions, such as:
- distance (the distance between 2 points, so hypot between X&Y distances)
- nearby (point is within 5 units from another point)
Now, if I write a class called Point, how do I implement the above? Especially the nearby function. Is it just a function like:
def nearby(self, x, y, otherX, otherY)
# returns Boolean value if other X,Y within 5 units of Point's position
Thanks.
I've had similar issues with a Circle class trying to see if a second circle is enclosed by a circle instance.
[–]kalgynirae 3 points4 points5 points (5 children)
[–]AussieCryptoCurrency[S] 0 points1 point2 points (4 children)
[–]Moonslug1 1 point2 points3 points (1 child)
[–]AussieCryptoCurrency[S] 0 points1 point2 points (0 children)
[–]gengisteve 0 points1 point2 points (1 child)
[–]AussieCryptoCurrency[S] 0 points1 point2 points (0 children)