Determine whether a common point the two flat shapes: triangle, given
the coordinates of its vertices and the circle with the given radius and center at the origin.
I am from Russia and i cant get help in russian community help please if u understand what i whrite
Thats what i can but its not always true
the coordinates of its vertices and the circle with the given radius and center at the origin.
I am from Russia and i cant get help in russian community help please if u understand what i whrite
Thats what i can but its not always true
from math import sqrt print("Введите координаты первой точки через пробел: ") x1, y1 = (int(i) for i in input().split()) print("Введите координаты второй точки через пробел: ") x2, y2 = (int(i) for i in input().split()) print("Введите координаты третьей точки через пробел: ") x3, y3 = (int(i) for i in input().split()) print("Введите радиус окружности: ") R = int(input()) rast1 = abs(x1*y2 - x2*y1) / sqrt((y1-y2)**2 + (x2-x1)**2) rast2 = abs(x1*y3 - x2*y1) / sqrt((y1-y3)**2 + (x3-x1)**2) rast3 = abs(x3*y2 - x2*y1) / sqrt((y3-y2)**2 + (x2-x3)**2) if sqrt(x1 ** 2 + y1 ** 2)<=R: print("YES") elif sqrt(x2 ** 2 + y2 ** 2)<=R: print("YES") elif sqrt(x3 ** 2 + y3 ** 2)<=R: print("YES") if rast1 <= R and ( abs(y1) < R or abs(y2) < R ) and (abs(x1) < R or abs(x2) < R): print("YES") if rast2 <= R and ( abs(y1) < R or abs(y3) < R ) and (abs(x1) < R or abs(x3) < R): print("YES") if rast3 <= R and ( abs(y3) < R or abs(y2) < R ) and (abs(x3) < R or abs(x2) < R): print("YES") else: print("NO")Translation
from math import sqrt print ("Enter the coordinates of the first point separated by a space:") x1, y1 = (int (i) for i in input (). split ()) print ("Enter the coordinates of the second point separated by a space:") x2, y2 = (int (i) for i in input (). split ()) print ("Enter the coordinates of the third point separated by a space:") x3, y3 = (int (i) for i in input (). split ()) print ("Enter the radius of the circle:") R = int (input ()) rast1 = abs (x1 * y2 - x2 * y1) / sqrt ((y1-y2) ** 2 + (x2-x1) ** 2) rast2 = abs (x1 * y3 - x2 * y1) / sqrt ((y1-y3) ** 2 + (x3-x1) ** 2) rast3 = abs (x3 * y2 - x2 * y1) / sqrt ((y3-y2) ** 2 + (x2-x3) ** 2) if sqrt (x1 ** 2 + y1 ** 2) <= R: print ("YES") elif sqrt (x2 ** 2 + y2 ** 2) <= R: print ("YES") elif sqrt (x3 ** 2 + y3 ** 2) <= R: print ("YES") if rast1 <= R and (abs (y1) <R or abs (y2) <R) and (abs (x1) <R or abs (x2) <R): print ("YES") if rast2 <= R and (abs (y1) <R or abs (y3) <R) and (abs (x1) <R or abs (x3) <R): print ("YES") if rast3 <= R and (abs (y3) <R or abs (y2) <R) and (abs (x3) <R or abs (x2) <R): print ("YES") else: print ("NO")