-
Notifications
You must be signed in to change notification settings - Fork 1
/
Lenses.m
52 lines (44 loc) · 1.49 KB
/
Lenses.m
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
classdef Lenses
% Creates objects for the cornea and lens.
% Also calculates focal length.
% Can be used with values for radius of curvature or optical power
% Properties:
% P1 - Frontside optical power
% P2 - Backside optical power
% RefIndx1 - Refractive index prior to the lens
% RefIndx2 - Refractive index in the lens
% d - Thickness of the lens
% focal - Focal length of the lens
% Methods:
% this_lens - Defines the properties of the lens
% get_power - Calculates the power of the lens
properties
% FrontRad % Frontside radius of curvature
% BackRad % Backside radius of curvature
P1
P2
RefIndx1
RefIndx2
d
focal
power
TF
end
methods
function this_lens = Lenses(P1,P2,RI1,RI2,d)
this_lens.P1 = P1;
this_lens.P2 = P2;
this_lens.RefIndx1 = RI1;
this_lens.RefIndx2 = RI2;
this_lens.d = d;
end
% function f = get_P(obj)
% n=obj.RefIndx2/obj.RefIndx1;
% f=(1/((n-1)*(1/obj.FrontRad-1/obj.BackRad+((n-1)*obj.d)/(n*obj.FrontRad*obj.BackRad))));
% %f=(1/((obj.RefIndx1/obj.RefIndx2-1)*(1/obj.FrontRad+1/obj.BackRad)));
% end
function power = get_power(obj)
power = obj.P1+obj.P2-obj.P1*obj.P2*obj.d/obj.RefIndx2;
end
end
end