Skip to content

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
julia
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 the ray with a sphere

Polarization kwargs

  • show_polarization = false: overlay the E-field curve for a PolarizedRay (throws an ArgumentError for 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 the t = 0 snapshot Re{E⊥·exp(i·k·s)} along the accumulated optical path s. Values finer than plotted length / 2000 are clamped with a warning.

  • pol_amplitude = nothing: curve amplitude [m] at the maximum |E⊥|, default pol_λ/4

  • pol_ppl = 32: sample points per pol_λ along the curve

  • pol_color = :crimson: field curve color

  • pol_linewidth = 2.0: field curve line width

Makie kwargs

  • color = :blue: ray color

  • linewidth = 1.0: ray line width

  • transparency = true: ray transparency

Additional kwargs can be passed into the line plot.

source

Beams 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
julia
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 a Beam{T, <:PolarizedRay} (throws an ArgumentError for 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 the t = 0 snapshot Re{E⊥·exp(i·k·s)} along the accumulated optical path s. Values finer than plotted length / 2000 are clamped with a warning.

  • pol_amplitude = nothing: curve amplitude [m] at the maximum |E⊥|, default pol_λ/4

  • pol_ppl = 32: sample points per pol_λ along the curve

  • pol_color = :crimson: field curve color

  • pol_linewidth = 2.0: field curve line width

source

Groups of beams ​

BeamletOptics.render! Method
julia
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.

source

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.

julia
render!(ax, beam; show_polarization=true, pol_color=:orange)