diff options
author | ywang <yw05@forksworld.de> | 2019-12-16 19:53:03 +0100 |
---|---|---|
committer | ywang <yw05@forksworld.de> | 2020-04-12 16:07:16 +0200 |
commit | 797544564eb6224b8ab3b12b33b01a66942d0101 (patch) | |
tree | 900f0dfced60febe0333ab9256d94495d9bd84a4 /advtrains/helpers.lua | |
parent | ad0713547c45930254473d8dc2b198b0587183d2 (diff) | |
download | advtrains-797544564eb6224b8ab3b12b33b01a66942d0101.tar.gz advtrains-797544564eb6224b8ab3b12b33b01a66942d0101.tar.bz2 advtrains-797544564eb6224b8ab3b12b33b01a66942d0101.zip |
Stable code
Diffstat (limited to 'advtrains/helpers.lua')
-rw-r--r-- | advtrains/helpers.lua | 16 |
1 files changed, 0 insertions, 16 deletions
diff --git a/advtrains/helpers.lua b/advtrains/helpers.lua index 9afe72d..c398025 100644 --- a/advtrains/helpers.lua +++ b/advtrains/helpers.lua @@ -398,22 +398,6 @@ function advtrains.decode_pos(pts) return vector.new(dec(strx), dec(stry), dec(strz))
end
--- Solve quadratic equations (i.e. a*x^2 + b*x + c = 0)
-function advtrains.solve_quadratic_equation(a, b, c)
- if not (a and b and c) then return nil end
- if a == 0 then return {-c/b, -c/b} end -- avoid division by zero
- local delta = (b*b - 4*a*c)
- if delta < 0 then return {-b/2/a,-b/2/a} end -- ignore imaginary part
- return {((-b+math.sqrt(delta))/2/a),((-b-math.sqrt(delta))/2/a)}
-end
-
--- safe square root
--- Negative return values indicate imaginary numbers.
-function advtrains.safesqrt(a)
- if a >= 0 then return math.sqrt(a) end
- return 0 - math.sqrt(-a)
-end
-
--[[ Benchmarking code
local tdt = {}
local tlt = {}
|