Python: Geometry: Consider ten points in the 2D space. Two circles are also cons
ID: 3789578 • Letter: P
Question
Python:
Geometry: Consider ten points in the 2D space. Two circles are also considered that include the most of the points. Prepare the program for the following: find which of them belong to any of two circles: C1(6, 8) R = 4, C2(15, 11) R = 6 is there any point that does not belong to any of the two circles? If so, please give the points find the two closest points Data points (5, 6), (6, 5), (6, 7), (8, 1), (9, 8), (10, 12), (12, 13) (12, 10), (13, 14), (14, 7) Circles Circle1(6, 8) R = 4. Circle 2(15, 11) R = 6 Output: The program will show: the points the points that belong to any of the two circles the points that do not belong to any of the two circles the two closest points Design: One solution could be using two functions. The function will compute the Euclidean distance between any pair of points. The function2 will have the data points and the circles points.Explanation / Answer
# Hello World program in Python
def Find(circleX,circleY,circleR,newX,newY):
result = 1
result = (newX-circleX)*(newX-circleX)+(newY-circleY)*(newY-circleY)
if result < circleR:
print "Inside Circle(",newX,",",newY,")"
else:
print "Outside Circle(",newX,",",newY,")"
#Circle Values
FirstCircleX=6
FirstCircleY=8
FirstCircleR=4
SecondCircleX=15
SecondCircleY=11
SecondCircleR=6
coX=eval(raw_input('Enter Co-ordinate X: '))
coY=eval(raw_input('Enter Co-ordinate Y:'))
Find(FirstCircleX,FirstCircleY,FirstCircleR,coX,coY)
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.