-
Notifications
You must be signed in to change notification settings - Fork 0
/
bounds.py
25 lines (20 loc) · 851 Bytes
/
bounds.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
######################################################################
# This file copyright the Georgia Institute of Technology
#
# Permission is given to students to use or modify this file (only)
# to work on their assignments.
#
# You may NOT publish this file or make it available to others not in
# the course.
#
######################################################################
from builtins import object
class BoundsRectangle(object):
def __init__(self, x_bounds, y_bounds):
self.x_bounds = x_bounds
self.y_bounds = y_bounds
def contains(self, xy):
return ((self.x_bounds[0] <= xy[0] <= self.x_bounds[1])
and (self.y_bounds[0] <= xy[1] <= self.y_bounds[1]))
def __repr__(self):
return f'(({self.x_bounds[0]}, {self.y_bounds[0]}), ({self.x_bounds[1]}, {self.y_bounds[1]}))'