Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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. >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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started