-
Notifications
You must be signed in to change notification settings - Fork 26
/
Kalin_georgiev_17.py
38 lines (22 loc) · 1.06 KB
/
Kalin_georgiev_17.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import math
def check_circles(c1_center, c1_radius, c2_center, c2_radius):
(x1, y1) = c1_center
(x2, y2) = c2_center
distance_from_centers = math.sqrt((x1 - x2)**2 + (y1 - y2)**2)
sum_of_radiuses = c1_radius + c2_radius
#checks if the circles match each other
if distance_from_centers == 0 and c1_radius == c2_radius:
return "The given circles are MATCHING!"
#checks if the circles are touching each other
if distance_from_centers == sum_of_radiuses:
return "The given circles are TOUCHING!"
#checks if one circle contain the other other
elif distance_from_centers + c2_radius <= c1_radius or distance_from_centers + c1_radius <= c2_radius:
return "One circle is CONTAINING the other!"
#checks if circles are touching in two points
elif distance_from_centers < sum_of_radiuses:
return "The given circles are INTERSECTING!"
#then circles have no common points
else:
return "Circles have NO_COMMON points!"
#print(check_circles((1, 2), 3, (15, 27), 6))