Rendering rays and beams
Rays and beams are drawn as 3D lines. A ray without an intersection is drawn with the finite length flen, since its actual length is infinite. Example renderings can be found in the Basic rays, Basic beam and Beam groups sections.
Single rays
BeamletOptics.render! Method
render!(axis, ray; kwargs...)Renders a ray as a 3D line into the specified axis.
Keyword args
flen = 1.0: plotted length of the infinite ray in case of no intersection in [m]show_pos = false: marks the starting position of theraywith a sphere
Polarization kwargs
show_polarization = false: overlay the E-field curve for aPolarizedRay(throws anArgumentErrorfor a non-polarized ray)pol_λ = nothing: visualization wavelength [m], default = total plotted length / 20. This is a plotting parameter, not the physical ray wavelength; the curve shows thet = 0snapshotRe{E⊥·exp(i·k·s)}along the accumulated optical paths. Values finer thanplotted length / 2000are clamped with a warning.pol_amplitude = nothing: curve amplitude [m] at the maximum |E⊥|, defaultpol_λ/4pol_ppl = 32: sample points perpol_λalong the curvepol_color = :crimson: field curve colorpol_linewidth = 2.0: field curve line width
Makie kwargs
color = :blue: ray colorlinewidth = 1.0: ray line widthtransparency = true: ray transparency
Additional kwargs can be passed into the line plot.
sourceBeams of rays
A Beam is rendered by drawing every ray of the beam tree, including all child beams created at beamsplitters. Keyword arguments such as color or linewidth are passed on to each ray.
BeamletOptics.render! Method
render!(axis, beam; kwargs...)Render the entire beam of rays into the specified 3D-axis.
Keyword args
Refer to the plotting method of the AbstractRay for a list of keyword arguments.
Polarization kwargs
show_polarization = false: overlay the E-field curve for aBeam{T, <:PolarizedRay}(throws anArgumentErrorfor a beam of non-polarized rays). The curve is drawn once for the whole beam tree, not per ray, to preserve phase continuity.pol_λ = nothing: visualization wavelength [m], default = total plotted length / 20. This is a plotting parameter, not the physical ray wavelength; the curve shows thet = 0snapshotRe{E⊥·exp(i·k·s)}along the accumulated optical paths. Values finer thanplotted length / 2000are clamped with a warning.pol_amplitude = nothing: curve amplitude [m] at the maximum |E⊥|, defaultpol_λ/4pol_ppl = 32: sample points perpol_λalong the curvepol_color = :crimson: field curve colorpol_linewidth = 2.0: field curve line width
Groups of beams
BeamletOptics.render! Method
render!(axis, beam_group; kwargs...)Renders the BeamletOptics.AbstractBeamGroup into the specified axis.
Keywords arguments
render_every = 5: renders only every e.g. fifth individual beam in the group
Refer to the plotting method of the AbstractRay for further keyword arguments.
Polarization overlay
For a PolarizedRay or a Beam of polarized rays, render!(ax, beam; show_polarization=true) overlays a curve that shows the electric field component perpendicular to the ray direction along the optical path. The appearance of the curve is controlled via the pol_* keyword arguments listed above. Passing show_polarization=true for non-polarized rays throws an ArgumentError. An example is shown in the Polarized rays section.
render!(ax, beam; show_polarization=true, pol_color=:orange)