Add function for getting the x and y coordinates of the graph's center

This commit is contained in:
Robert Machmer 2015-12-24 00:40:50 +01:00
parent 6532d97cca
commit ebb82093fb

View File

@ -187,6 +187,13 @@ function Graph.new()
return minX, maxX, minY, maxY; return minX, maxX, minY, maxY;
end 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; return self;
end end