def bottomright(self): return Vec(self.x + self.w, self.y + self.h)
def topright(self): return Vec(self.x + self.w, self.y)
def bottomleft(self): return Vec(self.x, self.y + self.h)
def pos(self): return Vec(self.x, self.y)
def link(cls, a, b): return Vec(a, b - a)
def __iter__(self): for x, y in itertools.product( range(self.left, self.right), range(self.top, self.bottom)): yield Vec(x, y)
def center(self, value): x, y = value self.x, self.y = value - Vec.link(self.topleft, self.bottomright) / 2
def center(self): return self.pos + Vec.link(self.topleft, self.bottomright) / 2