Thin Lens Ray Tracer
Adjust focal length and object distance to see how a thin lens forms real or virtual images.
Snell's boundaries and Fermat's principle 🖖
Optics ray tracing simulates the path of light through lenses by applying Snell's law at boundaries. Statically, it follows Fermat's principle of least time: light travels along the path that minimizes travel time. In thick lens systems, spherical aberration occurs because rays striking the lens margins focus closer to the lens than central rays, necessitating complex doublets or aspheric profiles.
Two rays are all you need 🖖
A thin lens bends every ray leaving a point on the object so they reconverge at one image point, so you only have to track two easy ones. The parallel ray leaves the tip horizontally and exits through the focal point; the centre ray passes straight through the middle of the lens, undeviated. Wherever those two cross is the image. If they only meet when traced backwards, the image is virtual β that is the magnifying-glass case.
The image that flies through infinity 🖖
Slide the object toward the focal point and watch the image distance v race off to +β, vanish, then reappear far on the left as ββ β a virtual image. Nothing physically teleports; the lens equation 1/v = 1/f β 1/u is a MΓΆbius (fractional-linear) map, and such maps treat infinity as an ordinary point. Crossing u = f simply passes the image smoothly through that point at infinity, flipping it from real to virtual.
Example problems
- Converging lens - Converging lens: real inverted image
- Diverging lens - Diverging lens: virtual upright image
- At focus - Object at focal point: image at infinity
- Magnifier - Magnifier: virtual enlarged image