Lenses
Lenses are fundamental optical components used to focus or diverge light, making them essential for constructing imaging systems. The BeamletOptics.AbstractRefractiveOptic type provides a general definition of components that refract light. This package includes a variety of rotationally symmetric lens models to simulate simple imaging setups. All lens models provided as part of this package are based on SDFs. Refer to the Signed Distance Functions (SDFs) section for more information.
A concrete implementation is provided by the Lens type.
BeamletOptics.Lens Type
Lens{T, S <: AbstractShape{T}, N <: RefractiveIndex} <: AbstractRefractiveOptic{T, N}Represents an uncoated Lens with a homogeneous RefractiveIndex n = n(λ). Refer to the Lens and SphericalLens constructors for more information on how to generate lenses.
Fields
shape: geometry of the lens, refer toAbstractShapefor more informationn:RefractiveIndexfunction that returns n(λ)
Additional information
Refractive index
The chromatic dispersion of the lens is represented by a λ-dependent function for n and must be provided by the user. For testing purposes, an anonymous function, e.g. λ -> 1.5 can be passed such that the lens has the same refractive index for all wavelengths.
Constructing lens shapes
In practice, a great variety and mixture of different lens shapes exists – e.g. spherical and aspherical lenses surfaces and all combinations thereof. Usually a lens is a block of a transparent, dielectric material with two optically active surfaces (fancy special cases using the sides of the lens as well exist, e.g. for HUD displays). It is common to describe such a lens by specifying the properties of the two surfaces and the material in between. This package, however, works with closed volume shapes for all of its optical elements and any erroneous (i.e. non-watertight) SDF might result in unphysical behaviour. Refer to the Geometry representation section for more information.
Lens constructors
One of the following constructors can be used to generate lens objects:
Lensconstructor- capable constructor for a wide combination of surface types (spherical, aspherical, etc.)
SphericalLensconstructor- simplified constructor for spherical surfaces
Refer to the specific documentation or enter e.g. ? Lens into the REPL to learn more about the constructors and their interfaces, as well as sign definitions and so on.
Surface based lens construction
To make it easier to specify lenses similar to established optical simulation frameworks, e.g. Zemax, the BeamletOptics.AbstractSurface API can be used. This is a helper interface for surfaces specifications and interprets them to the corresponding SDF-based volume representation.
Warning
It is important to note that BMO does not work with these surfaces representations directly for ray tracing. All shapes are translated to closed volumes internally.
Currently the following surface types are implemented:
julia> BeamletOptics.list_subtypes(BeamletOptics.AbstractSurface);
└── BeamletOptics.AbstractSurface
├── BeamletOptics.AbstractCylindricalSurface
│ ├── BeamletOptics.AbstractAcylindricalSurface
│ │ └── AcylindricalSurface
│ ├── CylindricalSurface
│ └── RectangularFlatSurface
└── BeamletOptics.AbstractRotationallySymmetricSurface
├── CircularFlatSurface
├── EvenAsphericalSurface
└── SphericalSurface
At least 9 types have been found.A Lens can be then constructed with the following function call:
BeamletOptics.Lens Method
Lens(front_surface::AbstractRotationallySymmetricSurface, back_surface::AbstractRotationallySymmetricSurface, center_thickness::Real, n::RefractiveIndex)Constructs a new Lens object using the surface specifications front_surface and back_surface and the center_thickness. These inputs are used to construct a UnionSDF that consists of the appropriate sub-SDFs to represent the shape of the lens.
The material properties are supplied via the n parameter.
Additional information
Radius of curvature (ROC) sign definition
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
Meniscus
If your specification results in a meniscus lens, only spherical meniscus lenses are supported at the moment.
Lens constructor example
In practice, this works as follows: the bi-convex LB1811 lens consists of two spherical surfaces and can be constructed like this:
# refractive index of NBK7 for 532 and 1064 nm
NBK7 = DiscreteRefractiveIndex([532e-9, 1064e-9], [1.5195, 1.5066])
# lens diameter
d = BeamletOptics.inch
# lens types
r1 = 34.9e-3
r2 = -34.9e-3
l = 6.8e-3
LB1811 = Lens(
SphericalSurface(r1, d),
SphericalSurface(r2, d),
l,
NBK7
)
SDF-based spherical lenses
In order to model the lens surfaces shown above, the following SDF-based spherical lens shapes have been implemented:
The BeamletOptics.AbstractSurface will translate surface specifications into volume representations using the sub-volumes above. This is achieved by combining the sub-volumes via the BeamletOptics.UnionSDF-API in order to enable the quasi-surface-based design of spherical lens systems. Additional distance functions have been implemented in order to model aspherical and cylinder lenses.
Spherical lenses
Spherical lenses are characterized by surfaces with constant curvature, making them straightforward to model and ideal for basic imaging applications. The SphericalLens constructor can be used in order to define this lens type in a concise manner.
BeamletOptics.SphericalLens Function
SphericalLens(r1, r2, l, d=1inch, n=λ->1.5)Creates a spherical Lens based on:
r1: front radiusr2: back radiusl: lens thicknessd: lens diameter, default is one inchn:RefractiveIndexas a function of λ, i.e.n = n(λ)
Notes
Radius of curvature (ROC) sign
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
Thin lenses
If l is set to zero, a ThinLens will be created. However, note that the actual lens thickness will be different from zero.
Below, several spherical lenses are recreated from manufacturer data.
The spherical lenses are shown below. To recreate this figure, refer to the Spherical lens example.

Aspherical lenses
Aspherical lenses offer more advanced control over aberrations, enabling higher performance in specialized optical systems. The package offers surface support for rotationally symetrical aspheric lenses that adhere to the DIN ISO 10110 convention with even terms.
To construct a lens with any possible combination of convex/concave, spherical/aspherical surfaces you can use the Lens constructor with the EvenAsphericalSurface surface specification type.
A complex example of such a lens might look like the following example. This lens has the following peculiarities:
The front surface is an aspherical convex surface with a clear diameter smaller than the full mechanical diameter
The back surface is an aspherical concave surface which first curves outwards before change slope and curving invards, giving a more "convex" like character while still beeing a concave lens by definition. Also this surface extends towards the full outer diameter.
Warning
Aspheric lenses are somewhat experimental at the moment. Use this feature with some caution when building unconventional lenses. Default/simple aspheres work fine.
L3 = Lens(
EvenAsphericalSurface(
3.618e-3, # r
3.04e-3, # d
-44.874, # conic
[0,-0.14756*(1e3)^3, 0.035194*(1e3)^5, -0.0032262*(1e3)^7,
0.0018592*(1e3)^9, 0.00036658*(1e3)^11, -0.00016039*(1e3)^13,
-3.1846e-5*(1e3)^15] # coeffs
),
EvenAsphericalSurface(
2.161e-3, # r
3.7e-3, # d
-10.719, # conic
[0,-0.096568*(1e3)^3, 0.026771*(1e3)^5, -0.011261*(1e3)^7,
0.0019879*(1e3)^9, 0.00015579*(1e3)^11, -0.00012433*(1e3)^13,
1.5264e-5*(1e3)^15] # coeffs
),
0.7e-3, # center_thickness
n -> 1.580200 # refractive index
)
Aspherical lens example
Refer to the Simple aspherical lens example for a showcase on how to implement a plano-convex asphere.
Cylindrical lenses
Cylindrical lenses are non-rotationally symmetric lenses where a spherical or aspherical curvature is present only in one dimension, i.e. leading to a cylindrical shape. Thus, they focus or collimate light only in one dimension. This package currently supports convex/concave cylindrical and acylindrical lenses with an even aspheric deviation from the cylindrical shape.
A plano-convex cylindrical lens can be constructed in the following way. Note that for this lens type a plano-surface can be constructed by passing a RectangularFlatSurface to the lens constructor:
r = 5.2e-3 # radius
d = 10e-3 # diameter/width of the cylindric portion
h = 20e-3 # height/length of the cylinder
ct = 5.9e-3 # center thickness
lens = Lens(
CylindricalSurface(r, d, h),
ct,
n -> 1.517
)
An acylindrical lens can easily be constructed using the AcylindricalSurface surface type:
radius = -15.538e-3
diameter = 25e-3
height = 50e-3
conic_constant = -1.0
lens = Lens(
BeamletOptics.AcylindricalSurface(
radius,
diameter,
height,
conic_constant,
[0, 1.1926075e-5*(1e3)^3, -2.9323497e-9*(1e3)^5, -1.8718889e-11*(1e3)^7, -1.7009961e-14*(1e3)^9, 3.5481542e-17*(1e3)^11, 6.5241296e-20*(1e3)^13]
),
7.5e-3,
n -> 1.777
)
Doublet lenses
The DoubletLens is an example for a multi-shape object as mentioned in the Single and multi-shaped objects section. For spherical doublet lenses the following constructor can be used.
BeamletOptics.SphericalDoubletLens Method
SphericalDoubletLens(r1, r2, r3, l1, l2, d, n1, n2)Generates a two-component "cemented" doublet lens consisting of two spherical lenses. For radii sign definition, refer to the SphericalLens constructor.
Arguments
r1: radius of curvature for first surfacer2: radius of curvature for second (cemented) surfacer3: radius of curvature for third surfacel1: first lens thicknessl2: second lens thicknessd: lens diametern1: first lensRefractiveIndexn1: second lensRefractiveIndex
The following image shows the AC254-150-AB doublet lens for 488 and 707 nm, colored blue and red respectively. It has been created using the SphericalDoubletLens constructor shown above.

Spherical lens example
For a complex showcase featuring spherical singlet and doublet lenses, refer to the Double Gauss lens example page.
Triplet lenses
The TripletLens extends the doublet to three cemented elements, which share two common surfaces. For spherical triplet lenses the following constructor can be used.
BeamletOptics.TripletLens Type
TripletLensRepresents a three-component cemented triplet lens with three respective refractive indices n = n(λ). See also SphericalTripletLens.
Fields
Additional information
Clear apertures
If the surfaces need different clear apertures (e.g. a steep last surface), build the elements via Lens(SphericalSurface(r1, d1), SphericalSurface(r2, d2), l, n) and pass them to TripletLens. SphericalTripletLens uses one diameter for all surfaces.
Air gap
This component type strongly assumes that all three lenses are mounted fully flush with respect to each other. Gaps between the components might lead to incorrect results.
Total internal reflection
Total internal reflection at a cemented interface between two elements is not modeled correctly.
BeamletOptics.SphericalTripletLens Method
SphericalTripletLens(r1, r2, r3, r4, l1, l2, l3, d, n1, n2, n3)Generates a three-component "cemented" triplet lens consisting of three spherical lenses. The middle and back lens are translated along +y so that they sit flush. For radii sign definition, refer to the SphericalLens constructor.
Arguments
r1: radius of curvature for first surfacer2: radius of curvature for second (first cemented) surfacer3: radius of curvature for third (second cemented) surfacer4: radius of curvature for fourth surfacel1: first lens thicknessl2: second lens thicknessl3: third lens thicknessd: lens diametern1: first lensRefractiveIndexn2: second lensRefractiveIndexn3: third lensRefractiveIndex
Additional information
Inf gives a plano surface.