1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
-- vim:syntax=lua tabstop=4
-- ------------------------------------
-- physics-related functions
-- ------------------------------------
-- !!! needs loaded "constants.lua" and "functions.lua"
-- compute velocity for stable orbit
function orbit_velocity(innermass, disttocenter)
local result = 0.0
if math.abs(disttocenter) > 0.1 then
result= math.sqrt(gravit_g * math.abs(innermass) / math.abs(disttocenter))
end
if gravit_physics < PH_PROPER then
result=result*math.sqrt(math.abs(disttocenter))
end
return result
end
|