forked from elsys/soft-dev-public
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomework1
More file actions
27 lines (24 loc) · 884 Bytes
/
Homework1
File metadata and controls
27 lines (24 loc) · 884 Bytes
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
from math import sqrt
def check_Circles(c1_c, c1_r, c2_c, c2_r):
if(c1_c == c2_c and c1_r == c2_r):
return "Matching"
c1_x, c1_y = c1_c
c2_x, c2_y = c2_c
distance = sqrt((c2_y - c1_y)**2 + (c2_x - c1_x)**2)
if(c1_r + c2_ < distance):
return "not intersecting"
if(c1_r + c2_r == distance):
return "touching"
if(c1_r + c2_r > distance):
if(distance + c1_r <= c2_r):
if(c1_r + distance == c2_r):
return "Circle B contains circle A and they are touching"
else:
return "Circle B contains circle A"
elif(distance + c2_r <= c1_r):
if(c1_r == c2_r + distance):
return "Circle A contains circle B and they are touching"
else:
return "Circle A contains circle B"
else:
return "Intersecting"