Download as pdf or txt
Download as pdf or txt
You are on page 1of 8

Ray Tracing

Imperial College: Joel Martı́nez González

1 Introduction.
The code developed allows us to explore the field of geometrical optics (e.g.,
figure 1), by modelling the three dimensional Snell’s law (n1 sin θ1 = n2 sin θ2 ).
To do this, we considered the unit vectors ⃗u∥ and ⃗u⊥ , where the latter is simply
going to be the normal vector from medium 1 to 2, ⃗n1→2 , so that we can solve
for ⃗u∥ , and obtain ⃗k2 by expressing both direction vectors as:

⃗k1 = sin θ1 ⃗u∥ + cos θ1 ⃗u⊥ ⃗k2 = sin θ2 ⃗u∥ + cos θ2 ⃗u⊥ (1.1)

2 Main results and discussion.


The correctness of our code was tested by contrasting numerical results with
known theoretical ones, usually relying on uniform beams (figures 10 and
3). We tested the image formation distance for rays parallel to the optical
axis (task 10) and objects at finite distances (task 11, figure 2), both of
which we can predict using small angle approximations[1]. The diffraction scale
can be calculated for the average visible light wavelength, with λ ≈ 550 nm,
ddif f = λf /D = 1.1 × 10−5 m, which is around 5 times bigger than the RMS
deviation calculated for our linear beam, dRM S = 2.12 × 10−6 m. This system
therefore provides an excellent focus, and little diffraction distortion should be
seen when examining our image in the focus. Following tasks 14 and 15, we
compared the performace of both orientations of a plano-convex lens (figures
4 and 5), to come to the conclusion that the spherical-planar orientation per-
forms around 4 times better, since RM S planar−→spherical ≈ 1.07 × 10−5 m and
RM S spherical−→planar ≈ 2.70 × 10−6 m.

To find the best performing lens for a given focal distance (0.1 m, otherwise, the
minimization program will tend to simply make f −→ ∞) and beam diameter
(10 mm), we used the Truncated Newton Method [2] with both curvatures as
variables. Ideally, for some focal distance f , the two curvature radii of a spher-
ical singlet are related through the Lensmaker’s Equation[3] for thick lenses
(2.1), so that in principle there are infinite solutions.
 
1 1 1 (n − 1)d
= (n − 1) − + (2.1)
f R1 R1 nR1 R2

1
Note that in (2.1), d=lens thickness, Ri =curvature radius, f =focal length and
n=refractive index. After collecting data, we see that for different initial values,
we obtain a range of different curvatures after convergence (each pair forming
a singlet with similar but not equal performance). We can also see that these
curvatures follow (2.1) very closely (see figure 6), so that it could be argued
that there are local minima located around each pair of radii that satisfy (2.1).
This is not an artifact produced by the initial conditions, since we made sure to
choose a uniform enough random distribution of initial curvatures (see figure
9). Looking at figure 7 we can see that the best peforming lens corresponds
to f = 0.1002, instead of 0.1 m, with an RMS of 2.43 × 10−6 m. Compared
to the plano-convex lens (in the best performing orientation) RMS for 10 mm
beams, which is 9.36 × 10−6 m, we see a ×4 improvement. Nevertheless, we
can see how the best RMS deviation decreases as we approach this particular
plano-convex configuration (figure 8, curv1 −→ 20 m and curv2 −→ 0 m).

3 Conclusions
Our code is able to reproduce expected phenomenons like image formation,
and satisfactorily follows theoretical equations. Plano-convex lenses (with the
beam facing the convex side) present an excellenty small focus size, though
for maximum performance both curvatures can be fine tuned. These plano-
convex lenses can easily have focus widths small enough to reasonably avoid
diffraction aberrations. Among some areas of improvement, we could design
a more systematic optimization, through double numerical optimization, or
using other methods that can better avoid local minima, like natural selection.
Regarding the code, ray bundles could have been modelled as matrices, allowing
for vectorization during the propagation process. Other Python libraries could
have also been used to speed up calculations by, for example, by compiling
Python into C (see just-in-time compilation).

References
[1] L. S. Pedrotti, “Basic geometrical optics,” Fundamentals of photonics,
pp. 73–116, 2008.
[2] P. Virtanen, R. Gommers, T. E. Oliphant, et al., “SciPy 1.0: Fundamental
Algorithms for Scientific Computing in Python,” Nature Methods, vol. 17,
pp. 261–272, 2020. doi: 10.1038/s41592-019-0686-2.
[3] J. E. Greivenkamp, Field guide to geometrical optics. SPIE press Belling-
ham, Washington, 2004, vol. 1.

2
Figure 1: Task 9: Some example rays traced through the spherical lens. Sys-
tem characteristics: curv = 30 (m−1 ), n1 = 1, n2 = 1.5.

Figure 2: Task 11: Image formation for objects in and above the focal axis.
System characteristics n1 = 1, n2 = 2, curv = 0.2 (m−1 ).

3
Figure 3: Task 12: Uniform beams of 5mm diameter.

Figure 4: Task 15: Plano-convex lens focus in both directions.

4
Figure 5: Task 15: Root mean squared radius vs. beam diameter at the
paraxial plane, for both orientations of the plano-convex lens.

Figure 6: Lens Optimization: Numerical data vs. Lensmaker Equation’s


prediction.

5
Figure 7: Lens Optimization: RMS radius vs. focal length after optimization.

Figure 8: Lens Optimization: RMS radius vs. both curvatures after optimiza-
tion.

6
Figure 9: Lens Optimization: Initial curvatures (before optimization).

7
Figure 10: Task 13: Spot diagrams for the 5mm diameter uniform beams.

You might also like