def rect_circle_overlap(rect, circle): """Checks whether any corners of a rect fall in/on a circle. rect: Rectangle object circle: Circle object """ p = copy.copy(rect.corner) print_point(p) if point_in_circle(p, circle): return True p.x += rect.width print_point(p) if point_in_circle(p, circle): return True p.y -= rect.height print_point(p) if point_in_circle(p, circle): return True p.x -= rect.width print_point(p) if point_in_circle(p, circle): return True return False
def rect_circle_overlap(rect, circle): """Sprawdza, czy dowolny narożnik prostokąta jest w obrębie koła lub na jego granicy. rect: obiekt Rectangle circle: obiekt Circle """ p = copy.copy(rect.corner) print_point(p) if point_in_circle(p, circle): return True p.x += rect.width print_point(p) if point_in_circle(p, circle): return True p.y -= rect.height print_point(p) if point_in_circle(p, circle): return True p.x -= rect.width print_point(p) if point_in_circle(p, circle): return True return False
def rect_in_circle(rect, circle): """Sprawdza, czy narożniki prostokąta są w obrębie koła lub na jego granicy. rect: obiekt Rectangle circle: obiekt Circle """ p = copy.copy(rect.corner) print_point(p) if not point_in_circle(p, circle): return False p.x += rect.width print_point(p) if not point_in_circle(p, circle): return False p.y -= rect.height print_point(p) if not point_in_circle(p, circle): return False p.x -= rect.width print_point(p) if not point_in_circle(p, circle): return False return True