File: physics.lua

package info (click to toggle)
gravit 0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 10,420 kB
  • ctags: 942
  • sloc: ansic: 6,841; makefile: 63; sh: 43
file content (25 lines) | stat: -rw-r--r-- 546 bytes parent folder | download | duplicates (4)
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