Lenses and Other Optical Components
Lenses
A number of helper functions are provided to make constructing simple lenses easier. Firstly ordinary thick lenses:
OpticSim.SphericalLens
— FunctionSphericalLens(insidematerial, frontvertex, frontradius, backradius, thickness, semidiameter; lastmaterial = OpticSim.GlassCat.Air, nextmaterial = OpticSim.GlassCat.Air, frontsurfacereflectance = 0.0, backsurfacereflectance = 0.0, frontdecenter = (0, 0), backdecenter = (0, 0))
Constructs a simple cylindrical lens with spherical front and back surfaces. The side walls of the lens are absorbing.
OpticSim.ConicLens
— FunctionConicLens(insidematerial, frontvertex, frontradius, frontconic, backradius, backconic, thickness, semidiameter; lastmaterial = OpticSim.GlassCat.Air, nextmaterial = OpticSim.GlassCat.Air, frontsurfacereflectance = 0.0, backsurfacereflectance = 0.0, frontdecenter = (0, 0), backdecenter = (0, 0))
Constructs a simple cylindrical lens with front and back surfaces with a radius and conic term. The side walls of the lens are absorbing.
OpticSim.AsphericLens
— FunctionAsphericLens(insidematerial, frontvertex, frontradius, frontconic, frontaspherics, backradius, backconic, backaspherics, thickness, semidiameter; lastmaterial = OpticSim.GlassCat.Air, nextmaterial = OpticSim.GlassCat.Air, frontsurfacereflectance = 0.0, backsurfacereflectance = 0.0, frontdecenter = (0, 0), backdecenter = (0, 0))
Cosntructs a simple cylindrical lens with front and back surfaces with a radius, conic and apsheric terms. The side walls of the lens are absorbing.
OpticSim.FresnelLens
— FunctionFresnelLens(insidematerial, frontvertex, radius, thickness, semidiameter, groovedepth; conic = 0.0, aspherics = nothing, outsidematerial = OpticSim.GlassCat.Air)
Create a Fresnel lens as a CSG object, can be concave or convex. Groove positions are found iteratively based on groovedepth
. For negative radii the vertex on the central surface is at frontvertex
, so the total thickness of the lens is thickness
+ groovedepth
. Aspherics currently not supported.
As well as idealized lenses:
OpticSim.ParaxialLens
— TypeParaxialLens{T} <: Surface{T}
surfacenormal
is the output direction of the lens. Paraxial lens cannot act as the interface between two materials, hence only a single outside material is specified, by default Air.
Create with the following functions
ParaxialLensEllipse(focaldistance, halfsizeu, halfsizev, surfacenormal, centrepoint; rotationvec = [0.0, 1.0, 0.0], outsidematerial = OpticSim.GlassCat.Air, decenteruv = (0.0, 0.0))
ParaxialLensRect(focaldistance, halfsizeu, halfsizev, surfacenormal, centrepoint; rotationvec = [0.0, 1.0, 0.0], outsidematerial = OpticSim.GlassCat.Air, decenteruv = (0.0, 0.0))
ParaxialLensHex(focaldistance, side_length, surfacenormal, centrepoint; rotationvec = [0.0, 1.0, 0.0], outsidematerial = OpticSim.GlassCat.Air, decenteruv = (0.0, 0.0))
Other Components
We also have some holographic elements implemented, note that these have not been extensively tested and should not be treated as wholely accurate at this stage.
It is relatively simple to extend the existing code to add these kinds of specialized surfaces providing a paired OpticalInterface
subclass is also defined. In this case the WrapperSurface
can often serve as a suitable base for extension.
OpticSim.WrapperSurface
— TypeWrapperSurface{T,S<:Surface{T}} <: Surface{T}
A generic surface type which serves as a basis for extension of Surface
s for custom OpticalInterface
subclasses. Essentially just forwards all Surface
and ParametricSurface
methods to a field of the WrapperSurface
named surface
. Also provides a generic implementation of surfaceintersection
which tests for an intersection with the underlying surface and returns either an EmptyInterval
or a half space (never a closed interval).
OpticSim.ThinGratingSurface
— TypeThinGratingSurface{T,S} <: WrapperSurface{T,S}
Surface type for use with ThinGratingInterface
.
ThinGratingSurface(surface::Surface{T}, interface::ThinGratingInterface{T})
OpticSim.HologramSurface
— TypeHologramSurface{T,S} <: WrapperSurface{T,S}
Surface type for use with HologramInterface
.
HologramSurface(surface::Surface{T}, interface::HologramInterface{T})
OpticSim.MultiHologramSurface
— TypeMultiHologramSurface{T,S} <: WrapperSurface{T,S}
Surface type for use with MultiHologramInterface
.
MultiHologramSurface(surface::Surface{T}, interface::MultiHologramInterface{T})
Eye Models
Eye models are often very useful in simulation of head mounted display systems. We have two models implemented currently.
OpticSim.ModelEye
— FunctionModelEye(assembly::LensAssembly{T}, nsamples::Int = 17; pupil_radius::T = 3.0, detpixels::Int = 1000, transform::RigidBodyTransform{T} = identitytransform(T))
Geometrically accurate model of the human eye focussed at infinity with variable pupil_radius
. The eye is added to the provided assembly
to create a CSGOpticalSystem
with the retina of the eye as the detector.
The eye can be positioned in the scene using the transform
argument and the resolution of the detector specified with detpixels
. By default the eye is directed along the positive z-axis with the vertex of the cornea at the origin.
nsamples
determines the resolution at which accelerated surfaces within the eye are triangulated.
OpticSim.ArizonaEye
— FunctionArizonaEye(::Type{T} = Float64; accommodation::T = 0.0)
The popular Arizona eye model taken from this definition. The accommodation
of the eye can be varied in this model. Returns a DataFrame
specifying the prescription of the eye model.