diff --git a/code/rect.lua b/code/rect.lua index 32787e7..1120a61 100644 --- a/code/rect.lua +++ b/code/rect.lua @@ -9,10 +9,19 @@ function Rect:fromPoints(pt1, pt2) return o end +function Rect:getPoints() + return self.min, self.max +end + + function Rect:fromCoords(x1, y1, x2, y2) return Rect:fromPoints(Point:new(x1, y1), Point:new(x2, y2)) end +function Rect:getCoords() + return self.min.x, self.min.y, self.max.x, self.max.y +end + -- clone refers to a deep copy function Rect:clone() return Rect:fromCoords(self.min.x, self.min.y, self.max.x, self.max.y)