From ebb82093fb1a16af300f31e400cc5efcafd9d011 Mon Sep 17 00:00:00 2001 From: Robert Machmer Date: Thu, 24 Dec 2015 00:40:50 +0100 Subject: [PATCH] Add function for getting the x and y coordinates of the graph's center --- fd/Graph.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fd/Graph.lua b/fd/Graph.lua index 53043d2..b377b16 100644 --- a/fd/Graph.lua +++ b/fd/Graph.lua @@ -187,6 +187,13 @@ function Graph.new() return minX, maxX, minY, maxY; end + --- + -- Returns the x and y coordinates of the graph's center. + -- + function self:getCenter() + return ( ( maxX - minX ) * 0.5 ) + minX, ( ( maxY - minY ) * 0.5 ) + minY; + end + return self; end