-
Notifications
You must be signed in to change notification settings - Fork 0
/
Optics.lua
48 lines (41 loc) · 1.16 KB
/
Optics.lua
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
local Optics = {
eyeDiameter = 0.007, -- 7mm
}
setmetatable(Optics, {__index = Optics})
--- Lf = d.Rf
---@param diameter number
---@param ratioFocal number
---@return number focalLength m
function Optics:focalLength(diameter, ratioFocal)
return diameter * ratioFocal
end
--- Rf = Lf/D
---@param lengthFocal number
---@param diameter number
---@return number ratioFocal m
function Optics:focalRatio(lengthFocal, diameter)
return lengthFocal / diameter
end
--- Z = Lf/Rf
---@param lengthFocal number
---@param eyepieceFocalLength number
---@return number magnification
function Optics:magnification(lengthFocal, eyepieceFocalLength)
return lengthFocal / eyepieceFocalLength
end
--- N = f/D
---@param focalLength number
---@param focalRatio number
---@return number aperture m
function Optics:aperture(focalLength, focalRatio)
return focalLength / focalRatio
end
--- LGP (Db/Dr)²
---@param baseDiameter number
---@param referenceDiameter number
---@return number lgp
function Optics:lightGatheringPower(baseDiameter, referenceDiameter)
referenceDiameter = referenceDiameter or self.eyeDiameter
return (baseDiameter / referenceDiameter) ^ 2
end
return Optics