I know that it can be found on Google but I tried all that I could find and I kept getting errors/bugs.
In my circle class I have a function with this code:
# rect = rectangle.# @x & @y are the origin coordinates of the circle. x = rect.right if @x > rect.right x = rect.left if @x < rect.left y = rect.bottom if @y > rect.bottom y = rect.top if @y < rect.top return Point.new(x,y).distance(origin) < @radiusPoint-class Distance implementation:
def distance(other_point) Math.hypot(other_point.x - @x, other_point.y - @y) endIt does not always work as expected (unless I tested wrong which is possible).
Is this algorithm any good?
In my circle class I have a function with this code:
# rect = rectangle.# @x & @y are the origin coordinates of the circle. x = rect.right if @x > rect.right x = rect.left if @x < rect.left y = rect.bottom if @y > rect.bottom y = rect.top if @y < rect.top return Point.new(x,y).distance(origin) < @radiusPoint-class Distance implementation:
def distance(other_point) Math.hypot(other_point.x - @x, other_point.y - @y) endIt does not always work as expected (unless I tested wrong which is possible).
Is this algorithm any good?

