Skip to content

Rendering components and systems ​

Optical components are rendered by drawing their shape. Example renderings of the individual components can be found in the Mirrors, Lenses, Beamsplitters and Polarizers sections.

Components ​

The generic method below covers every BeamletOptics.AbstractObject, including groups of components such as an ObjectGroup, whose members are rendered one after another.

BeamletOptics.render! Method
julia
render!(ax, object; kwargs...)

Renders the object into the specified axis. Additional kwargs can be piped through to the backend.

Examples

It is recommended to use the following snippet in order to generate plots:

julia
using GLMakie, BeamletOptics

fig = Figure()
ax = LScene(fig[1,1]) # or Axis3
render!(ax, my_BMO_obj; color=:white)

Additional keyword arguments can be passed. Refer to the Makie and BeamletOptics documentation for supported options for each object.

source

Default colours ​

Several component types are rendered with a preset colour and transparency:

Typecolortransparencyalpha
AbstractRefractiveOptic:whitetrue–
AbstractReflectiveOptic:silverfalse–
Lens, DoubletLens, TripletLenslight blue RGBf(0.678, 0.847, 0.902)true0.5
ThinBeamsplitter:magentatrue–
NonInteractableObject:greyfalse–
IntersectableObject:greytrue–

Each default can be overridden with the corresponding keyword argument, e.g. render!(ax, lens; color=:orange) or render!(ax, mirror; transparency=true).

Polarizing filters ​

BeamletOptics.render! Method
julia
render!(ax, pf::PolarizationFilter; kwargs...)

Renders the PolarizationFilter pf into the specified ax, optionally with its transmission axis.

Keyword args

  • show_transmission_axis = true: draws the transmission_axis as a line on the filter

  • axis_color = :black: color of the transmission axis line

  • axis_linewidth = 2: line width of the transmission axis line

Remaining kwargs are passed on to the Makie mesh plot.

source
BeamletOptics.render! Method
julia
render!(ax, lipo::LinearPolarizer; kwargs...)

Renders the LinearPolarizer lipo into the specified ax, optionally with its transmission axis. The two substrate halves render like refractive optics, and the filter film is drawn in translucent green.

Keyword args

  • show_transmission_axis = true: draws the transmission_axis as a line on the filter

  • axis_color = :black: color of the transmission axis line

  • axis_linewidth = 2: line width of the transmission axis line

Remaining kwargs are passed on to the Makie mesh plots of the substrate halves.

source

Systems ​

BeamletOptics.render! Method
julia
render!(ax::_RenderEnv, sys::AbstractSystem)

Render all objects contained in the system.

source

Shapes (advanced) ​

The following methods render the shapes that components are built from. They are mainly of interest when writing custom components, see the Signed Distance Functions (SDFs) and Meshes pages of the API documentation. A BeamletOptics.UnionSDF is rendered by drawing each of its SDFs. The spherical, aspherical and acylindrical lens surfaces have dedicated analytical renderers that are used automatically when a lens is rendered.

BeamletOptics.render! Method
julia
render!(ax, sdf; kwargs...)

Render the surface of the sdf based on the marching cubes algorithm into the specified axis.

Additional kwargs can be passed into the mesh plot.

source
BeamletOptics.render! Method
julia
render!(ax, s::ConicSDF; color=:silver, kwargs...)

Analytical surface renderer for a BeamletOptics.ConicSDF. Renders the concave/convex conic front reflective face, the cylindrical substrate side wall, and the flat rear substrate base into ax.

source
BeamletOptics.render! Method
julia
render!(ax, d::DifferenceSDF{T, <:ConicSDF}; color=:silver, kwargs...)

Analytical surface renderer for a BeamletOptics.ConicSDF with an axial cylindrical bore (e.g. Cassegrain, Ritchey-Chrétien, or OAP with :collimated through-hole). If the bore is non-axial, falls back to the general SDF MarchingCubes renderer.

source
BeamletOptics.render! Method
julia
render!(axis, mesh; kwargs...)

Renders the mesh into the specified axis.

Keyword args

  • show_normals = false: shows a small line

  • show_normals_length = 0.01:

Makie kwargs

source