From ba1c0f0c898c56fcdb323be40bf71108933163d1 Mon Sep 17 00:00:00 2001 From: lustlion Date: Sun, 13 Mar 2022 10:43:07 +0100 Subject: [PATCH] getPoints and getCoords --- code/rect.lua | 9 +++++++++ 1 file changed, 9 insertions(+) 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)