-
Notifications
You must be signed in to change notification settings - Fork 0
/
OffAxis.py
70 lines (51 loc) · 1.77 KB
/
OffAxis.py
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import math
from Prepare import Upie, FAR_L
import Calculate
import Materials
def func_tpie(t, n, npie, r, I, Ipie):
cos_I = math.cos(math.radians(I))
cos_Ipie = math.cos(math.radians(Ipie))
a = (npie * cos_Ipie - n * cos_I) / r
if Materials.lens[0]['d'] < FAR_L:
c = a
else:
c = n * cos_I * cos_I / t + a
b = npie * cos_Ipie * cos_Ipie
return b / c
def func_spie(s, n, npie, r, I, Ipie):
cos_I = math.cos(math.radians(I))
cos_Ipie = math.cos(math.radians(Ipie))
a = (npie * cos_Ipie - n * cos_I) / r
if Materials.lens[0]['d'] < FAR_L:
k = a
else:
k = n / s + a
return npie / k
def func_D(h1, h2, L, U, r, n, npie):
U_pie = Upie(L, U, r, n, npie)
sinUpie = math.sin(math.radians(U_pie))
return (h1-h2)/sinUpie
def off_axis():
lights = Calculate.meri_off()
s = Materials.lens[0]['d'] / math.cos(math.radians(lights[0]['U']))
t = s
h = []
for i in range(0, len(Materials.lens)):
h.append(Materials.lens[i]['r'] * math.sin(math.radians(lights[i]['U'] + lights[i]['I'])))
for i in range(0, len(Materials.lens)):
if i == 0:
n = 1
else:
n = Materials.lens[i-1]['n']
spie = func_spie(s, n, Materials.lens[i]['n'], Materials.lens[i]['r'], lights[i]['I'], lights[i]['Ipie'])
tpie = func_tpie(t, n, Materials.lens[i]['n'], Materials.lens[i]['r'], lights[i]['I'], lights[i]['Ipie'])
if i == len(Materials.lens) - 1:
s = spie
t = tpie
else:
# 过渡公式
light = lights[i]
D = func_D(h[i], h[i + 1], light['L'], light['U'], Materials.lens[i]['r'], n, Materials.lens[i]['n'])
t = tpie - D
s = spie - D
return [s, t]