Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.
Another typical mechanism for determining whether two objects are intersecting is by computing bounding circles of the objects. Then determining whether the objects overlap is simply testing if the bounding circles overlap. In this post-lab, you will demonstrate your knowledge of conditionals and test cases by writing a function to perform this computation.
Create a function called are_circles_overlapping(circle_1_x,
circle_1_y, circle_1_radius, circle_2_x, circle_2_y,
circle_2_radius)
in a file called circle_overlap.py.
The function should return True
if the circle centered
at (circle_1_x, circle_1_y) with a radius
of circle_1_radius is overlapping with the circle centered
at (circle_2_x, circle_2_y) with a radius
of circle_2_radius. The function should
return False
otherwise. Consider two circle touching
to be not overlapping.
You can compute whether two circles are overlapping by determining if the center points of the circles are within the sum of the circle radii.
Test your function by calling the function multiple times with different parameters. Make sure you follow the course's code conventions.
Function Parameters | Expected Output |
---|---|
0, 0, 2, 1, 1, 2 | True |
0, 0, 2, 4, 4, 2 | False |
2, 2, 2, 3, 3, 2 | True |
Submissions for post labs are to be done via the inquire system. Go to http://inquire.roanoke.edu/ You should see a section for post labs. Submit your .py file to the appropriate post lab location.
Post labs are to be done individually. Sharing files between students is not allowed. Doing so is an Academic Integrity violation, and will be treated as such.