Question: PYTHON PROGRAMMING Computing a smallest (axis-aligned) rectangle that encloses a set of objects in the plane is a very common computational problem arising in graphics
PYTHON PROGRAMMING
Computing a smallest (axis-aligned) rectangle that encloses a set of objects in the plane is a very common computational problem arising in graphics and thus game development too. Write a function, called min_enclosing_rectangle, that has 3 input parameters. The first is a number representing a radius of a circle and the next two are two numbers representing the x- and y-coordinates of its center. Consider the smallest axis-aligned rectangle that contains that circle. The function should return the x- and y-coordinates of the bottom-left corner of that rectangle. If side is a negative number, min_enclosing_rectangle should return None.
>>> # testing:
>>> min_enclosing_rectangle(1,1,1)
(0, 0)
>>> min_enclosing_rectangle(4.5, 10, 2)
(5.5, -2.5)
>>> min_enclosing_rectangle(-1, 10, 2)
>>> min_enclosing_rectangle(500, 1000, 2000)
(500, 1500)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
