I've been writing a program to trace light rays through various surfaces. I have it simulating refraction and reflection (including total internal reflection) and out of curiosity I wanted to try seeing if my simulation would work with lenses.
As I am simulating actual rays I get spherical aberration and I was wondering if a surface exists that can simulate the same behaviour as an ideal lens (the one's shown in textbooks, so light from an object infinitely far away converging to a single focal point after passing through the lens).
For reflection, such a surface is a parabola, so I thought that it would be the same for refraction, but this is not the case. (Might be a problem with my simulation as opposed to reality, but I also double checked it by hand resulting in the same aberration).
Apparently an ideal lens cannot exist in reality due to the thickness of lenses, but as I am using a simulation I thought maybe I could fake an infinitely thin surface by using a plane, but have the normal of a point on that plane be defined by a different surface: This reduced the aberration but did not eliminate it. (When testing I used the equation of a paraboloid to define the normals on the surface).
I know that I can just use the lens equation to calculate the focal point and set the ray direction to go to said focal point, and I am also aware there is an equation for calculating the focal point when rays are entering the lens at an angle, but out of curiosity I want to know if there exists an equation for a surface that can do so.
My simulation is in 3D testing on spheres, paraboloids, hyperboloids and ellipsoids, but for the sake of simplicity I've described the problem in 2D (shouldn't be much difference anyway).
Some of my other thoughts - not exactly relevant to the question
Using a flat surface with a different equation to describe its normals, as mentioned previously, could you then sample various points on the surface and solve for the normals using snell's law such that the refracted rays will converge at a single focal point? With this, could you then "join the dots" taking the calculated normals into account to generate a surface and would this be a pretty good approximate of the ideal lens surface?