from Point import *

class Rectangle:
    def __init__(self, h, w):
        """Creates a new rectangle.  h, w must be positive numbers"""
        self.height = float(h)
        self.width = float(w)
        self.center = None
    def __str__(self):
        result = 'height: ' + str(self.height)
        result = result + ', width: ' + str(self.width)
        if self.center != None:
            result = result + ', center: ' + str(self.center)
        return result
    def locate(self, p):
        self.center = p
    def printIt(self):
        print str(self)
    def area(self):
        return self.height * self.width
    def inIt(self, p):
        if self.center == None: return False
        xIn = abs(p.x - self.center.x) <= self.width/2.0
        yIn = abs(p.y - self.center.x) <= self.height/2.0
        return xIn and yIn
        
        
        

