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
| f = int(input('Focale (mm) :'))
N = float(input('Ouverture (N) :'))
c = float(input('Cercle de confusion (mm) :'))
p = float(input('Distance de mise au point (m) :'))
H = (f**2/(N*c)+f)/1000
h = H/2
p1 = ((p*1000)*f**2/(f**2+N*c*((p*1000)-f)))/1000
p2 = ((p*1000)*f**2/(f**2-N*c*((p*1000)-f)))/1000
pdc = p2-p1
pdc1 = p-p1
pdc2 = p2-p
r1 = (pdc1/pdc)*100
r2 = (pdc2/pdc)*100
pdf = 2*N*c
inf = 'Infini'
nap = 'Non applicable'
print('Hyperfocale :',round(H, 2), 'm')
print('Demie hyperfocale :',round(h, 2), 'm')
print('Premier plan net :',round(p1, 2), 'm')
if p2 <= 0:
print('Dernier plan net :', inf)
print('Profondeur de champ :',nap)
print('Profondeur de champ avant :',round(pdc1, 2), 'm')
print('Profondeur de champ arrière :',inf)
print('Ratio avant :',nap)
print('Ratio arrière :',nap)
else:
print('Dernier plan net :',round(p2, 2), 'm')
print('Profondeur de champ :',round(pdc, 2), 'm')
print('Profondeur de champ avant :',round(pdc1, 2), 'm')
print('Profondeur de champ arrière :',round(pdc2, 2), 'm')
print('Ratio avant :',round(r1, 2), '%')
print('Ratio arrière :',round(r2, 2), '%')
print('Profondeur de foyer :',round(pdf ,3), 'mm') |
Partager