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
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:
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.
Default colours
Several component types are rendered with a preset colour and transparency:
| Type | color | transparency | alpha |
|---|---|---|---|
AbstractRefractiveOptic | :white | true | – |
AbstractReflectiveOptic | :silver | false | – |
Lens, DoubletLens, TripletLens | light blue RGBf(0.678, 0.847, 0.902) | true | 0.5 |
ThinBeamsplitter | :magenta | true | – |
NonInteractableObject | :grey | false | – |
IntersectableObject | :grey | true | – |
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
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 thetransmission_axisas a line on the filteraxis_color = :black: color of the transmission axis lineaxis_linewidth = 2: line width of the transmission axis line
Remaining kwargs are passed on to the Makie mesh plot.
sourceBeamletOptics.render! Method
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 thetransmission_axisas a line on the filteraxis_color = :black: color of the transmission axis lineaxis_linewidth = 2: line width of the transmission axis line
Remaining kwargs are passed on to the Makie mesh plots of the substrate halves.
sourceSystems
BeamletOptics.render! Method
render!(ax::_RenderEnv, sys::AbstractSystem)Render all objects contained in the system.
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
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.
sourceBeamletOptics.render! Method
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.
BeamletOptics.render! Method
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.
BeamletOptics.render! Method
render!(axis, mesh; kwargs...)Renders the mesh into the specified axis.
Keyword args
show_normals = false: shows a small lineshow_normals_length = 0.01:
Makie kwargs
source