--[[

    utility_math.lua
    code.google.com/p/love-td/
    
    Copyright (C) 2014 love-td

    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    **************************************************************
    
    **************************************************************
    
--]]

function getDist2D (x, y, x2, y2)
    return math.sqrt((x2 - x)^2 + (y2 - y)^2)
end

function getAngle (x, y, x2, y2)
    local deg = math.deg(math.atan2(y2-y, x2-x))
    if (deg < 0) then
        deg = deg + 360
    end
    
    return deg
end