The class Box

The class Box Box represents 2D bounding boxes of the 2D space.

class box.Box(xmin, ymin, xmax, ymax)

Public methods:

xmin

the x coordinate of the bottom left vertex of the box (float or int)

ymin

the x coordinate of the bottom left vertex of the box (float or int)

xmax

the x coordinate of the top right vertex of the box (float or int)

ymax

the y coordinate of the top right vertex of the box (float or int)

width

the width of the box

height

the height of the box

Methods:

aspect_ratio()

Returns the ratio width/height of the box

fitting_window(asp)

Returns the smallest Box enclosing the box centered that has the given aspect ratio

The class suports the method str.

The class Box is partially implemented in the file box.py. You just have to implement the method fitting_window().

You can pass the tests of the following test files test-box.txt.