%!
(lenses.ps) run
54 54 scale
0.01 setlinewidth
1 1 translate

newpath
0 0 moveto
6 0 lineto
6 1 lineto
7.5 1 lineto
stroke

newpath
0 3 moveto
6 3 lineto
6 2 lineto
7.5 2 lineto
stroke

/h 1.5 15 sin div def
/a h h mul 1.5 1.5 mul sub sqrt def

newpath
a .25 add 1.5 h 165 195 arc
stroke
a -1 mul .25 add 1.5 h 345 15 arc
stroke

/h2 .5 27 sin div def
/a2 h2 h2 mul .5 .5 mul sub sqrt def

newpath
a2 7 add 1.5 h2 153 207 arc
stroke
a2 -1 mul 7 add 1.5 h2 333 27 arc
stroke


/N 60 def
/dy 3 N div def
/y dy def

N 1 sub{

/p0 [-1 y] def
/v0 [1 0] def
/p1 p0 v0 [a .25 add 1.5] h hit def
/n1 [a .25 add 1.5] p1 gradient normalized def
/v1 n1 v0 1.5 refraction def
/p2 p1 v1 [a -1 mul .25 add 1.5] h hit def
/n2 [a -1 mul .25 add 1.5] p2 gradient normalized def
/v2 n2 v1 1 1.5 div refraction def
/p3 p2 v2 [0 1 -1.5] line-intersection def
/p4 p3 v2 [a2 7 add 1.5] h2 hit def
/n4 [a2 7 add 1.5] p4 gradient normalized def
/v4 n4 v2 1.5 refraction def
/p5 p4 v4 [a2 -1 mul 7 add 1.5] h2 hit def
/n5 [a2 -1 mul 7 add 1.5] p5 gradient normalized def
/v5 n5 v4 1 1.5 div refraction def
/p6 p5 v5 [1 0 -7.5] line-intersection def

newpath

p0 0 get p0 1 get moveto
p1 0 get p1 1 get lineto
p2 0 get p2 1 get lineto
p3 0 get p3 1 get lineto
p4 0 get p4 1 get lineto
p5 0 get p5 1 get lineto
p6 0 get p6 1 get lineto
0.001 setlinewidth
1 0 0 setrgbcolor
stroke

/y y dy add def
}repeat

newpath
10 1.5 moveto
8 2 lineto
0 0 0 setrgbcolor
stroke
10 1.5 moveto
8 1 lineto
stroke
10 1.5 .5 0 360 arc
stroke


showpage