Reference
This page contains the full source code documentation and the literature referenced througout this website.
Literature
B. A. Madruga, C. C. Dorian, M. Sehgal, A. J. Silva, M. Shtrahman, D. Aharoni and P. Golshani. Open-source, high performance miniature multiphoton microscopy systems for freely behaving animals, bioRxiv (2024).
A. Manny. Simulation of the contrast mechanisms of a heterodyne two-color interferometer. Master's thesis, Faculty of Aerospace Engineering and Geodesy, University of Stuttgart (Dec 2024).
L. Boussemaere. OpenRAMAN: a low-cost, high-performance open-source Raman spectrometer,
https://www.open-raman.org/. Hardware licensed under CERN-OHL-W-v2. Accessed 2026-07-31.B. Richards and E. Wolf. Electromagnetic diffraction in optical systems, II. Structure of the image field in an aplanatic system. Proc. R. Soc. Lond. A 253, 358–379 (1959).
G. Yun, K. Crabtree and R. A. Chipman. Three-dimensional polarization ray-tracing calculus I: definition and diattenuation. Appl. Opt. 50, 2855–2865 (2011).
G. Yun, S. C. McClain and R. A. Chipman. Three-dimensional polarization ray-tracing calculus II: retardance. Appl. Opt. 50, 2866–2874 (2011).
G. Fowles. Introduction to Modern Optics. Dover Books on Physics Series (Dover Publications, 1989).
M. Ware and J. Peatross. Physics of Light and Optics (Black & White) (Brigham Young University, Department of Physics, 2015).
B. Saleh and M. Teich. Fundamentals of Photonics. Wiley Series in Pure and Applied Optics (Wiley, 2019).
J. Arnaud. Representation of Gaussian beams by complex rays. Appl. Opt. 24, 538–543 (1985).
J. Ashcraft, poke v0.1.0, https://zenodo.org/10.5281/zenodo.7117214 (Sep 2022).
G. Wanner, E. Kochkina, C. Mahrdt, V. Müller, S. Schuster, G. Heinzel and K. Danzmann. Simulating laser interferometers for missions such as (E)Lisa, Lisa pathfinder and Grace follow-on. In: International Conference on Space Optics — ICSO 2014, Vol. 10563, edited by Z. Sodnik, B. Cugny and N. Karafolas (International Society for Optics and Photonics, SPIE, 2017); p. 105632G.
R. Herloski, S. Marshall and R. Antos. Gaussian beam ray-equivalent modeling and optical design. Appl. Opt. 22, 1168–1174 (1983).
D. DeJager and M. Noethen. Gaussian beam parameters that use Coddington-based Y–NU paraprincipal ray tracing. Appl. Opt. 31, 2199–2205 (1992).
A. W. Greynolds. Propagation Of Generally Astigmatic Gaussian Beams Along Skew Ray Paths. In: Diffraction Phenomena in Optical Engineering Applications, Vol. 0560, edited by D. M. Byrne and J. E. Harvey (International Society for Optics and Photonics, SPIE, 1986); pp. 33–51.
A. W. Greynolds. Vector Formulation Of The Ray-Equivalent Method For General Gaussian Beam Propagation. In: Current Developments in Optical Engineering and Diffraction Phenomena, Vol. 0679, edited by R. E. Fischer, J. E. Harvey and W. J. Smith (International Society for Optics and Photonics, SPIE, 1986); pp. 129–133.
R. Wilhelm. Comparing geometrical and wave-optical algorithms of a novel propagation code applied to the VLTI. In: Wave-Optical Systems Engineering, Vol. 4436, edited by F. Wyrowski (International Society for Optics and Photonics, SPIE, 2001); pp. 89–100.
A. W. Greynolds. Fat Rays Revisited: A Synthesis of Physical and Geometrical Optics with Gaußlets. In: Classical Optics 2014 (Optica Publishing Group, 2014); p. ITu1A.3.
N. Worku and H. Gross. Vectorial field propagation through high NA objectives using polarized Gaussian beam decomposition. In: Optical Trapping and Optical Micromanipulation XIV, Vol. 10347, edited by K. Dholakia and G. C. Spalding (International Society for Optics and Photonics, SPIE, 2017); p. 103470W.
E. Kochkina. Stigmatic and astigmatic Gaussian beams in fundamental mode : impact of beam model choice on interferometric pathlength signal estimates. Ph.D. Thesis, Leibniz U., Hannover (2013).
J. N. Ashcraft, E. S. Douglas, R. Anche, B. D. Dube, K. Z. Derby, L. Furenlid, M. Kautz, D. Kim, K. Milani and A. J. Riggs. A generalized expression for accelerating beamlet decomposition simulations. Opt. Express 32, 18068–18086 (2024).
E. Kochkina, G. Wanner, D. Schmelzer, M. Tröbs and G. Heinzel. Modeling of the general astigmatic Gaussian beam and its propagation through 3D optical systems. Appl. Opt. 52, 6030–6040 (2013).
International Organization for Standardization. ISO 10110-12:2019 Optics and photonics – Preparation of drawings for optical elements and systems – Part 12: Aspheric surfaces (2019).
J. Sasián. Aspheric Surfaces. In: Introduction to Lens Design (Cambridge University Press, 2019); pp. 21–29.
J. Korger, T. Kolb, P. Banzer, A. Aiello, C. Wittmann, C. Marquardt and G. Leuchs. The polarization properties of a tilted polarizer. Opt. Express 21, 27032–27042 (2013).
E. Hecht. Optik (De Gruyter, Berlin, Boston, 2018).
P. Hanrahan. A survey of ray-surface intersection algorithms. In: An Introduction to Ray Tracing (Academic Press Ltd., GBR, 1989); pp. 79–119.
T. Möller and B. Trumbore. Fast, minimum storage ray/triangle intersection. In: ACM SIGGRAPH 2005 Courses, SIGGRAPH '05 (Association for Computing Machinery, New York, NY, USA, 2005); p. 7–es.
S. Osher and R. Fedkiw. Signed Distance Functions. In: Level Set Methods and Dynamic Implicit Surfaces (Springer New York, New York, NY, 2003); pp. 17–22.
L. McMillan, G. D. Bruce and K. Dholakia. Meshless Monte Carlo radiation transfer method for curved geometries using signed distance functions. Journal of Biomedical Optics 27, 083003 (2022).
Index
BeamletOptics.BeamletOptics Module
BeamletOpticsNon-sequential 3D ray and Gaussian beamlet tracing for optical setups ("BMO"). Documentation: https://juliaphysics.github.io/BeamletOptics.jl/stable/
AI coding assistants
The package ships an agent skill that teaches assistants such as Claude Code how to use BMO. Install the copy matching this package version into a project with BeamletOptics.install_agent_skill.
BeamletOptics.Nullable Type
Nullable{T}An alias which results in Union{T, Nothing} to provide a shorter notation for struct fields which can containing nothing.
BeamletOptics.NullableVector Type
NullableVector{T}An alias which results in Union{Vector{T}, Nothing} to provide a shorter notation for struct fields which can containing nothing.
BeamletOptics.RefractiveIndex Type
RefractiveIndexUnion type that represents valid means to pass a refractive index n to e.g. AbstractObjects. The core assumption is that:
the refractive index is callable with a single
Numberargumentλto represent the wavelength in [m]the return value is a single
Numbervalue for the refractive index
Refer to e.g. DiscreteRefractiveIndex.
BeamletOptics._GOLDEN_ANGLE Constant
_GOLDEN_ANGLEThe golden angle π(3 - √5) ≈ 2.39996 rad, i.e. the azimuthal increment of the sunflower (Fibonacci) sampling shared by UniformDiscSource and UniformPointSource.
BeamletOptics._RenderTypes Type
A collection of all types from BMO which might be renderable in principle.
sourceBeamletOptics.AbstractBeam Type
AbstractBeam{T <: Real, R <: AbstractRay{T}}A generic type for a container type which holds rays, beams etc.
Parametrization:
A subtype of AbstractBeam is parameterized by its main data type T <: Real, as well as the underlying ray representation R <: AbstractRay{T}. If a beam is to be compatible with different AbstractRay implementations, it must be parameterized by T and R. However, it can also be set to a fixed type for T and R, i.e. MyBeam <: AbstractBeam{Float32, MyRay}.
Implementation reqs.
Subtypes of AbstractBeam must implement the following:
Fields:
parent: aNullablefield that holds the same type as the subtype, used for tree navigationchildren: a vector that holds the same type as the subtype, used for sub-beam tracking, i.e. beamsplitting
Functions:
_modify_beam_head!: modifies the beam path for retracing purposes_last_beam_intersection: returns the lastBeamintersectionempty!: resets the beam to its unsolved statefirst_ray: returns the start ray on the optical axis of the beam; for beamlets the first chief ray. Defines the genericposition/directionof the beam (the pivot for rotations)
The tree functions parent, children and isroot (from AbstractTrees) work via the parent/children fields.
Kinematic API:
AbstractBeams are BeamletOptics.Movable with a BeamletOptics.Directed frame, see BeamletOptics.AbstractKinematicTrait. Only root beams can be moved. Every move resets the beam to its untraced start state via empty!; moving a child beam throws an ArgumentError. Rotations are applied about the position of the beam, i.e. the start of first_ray. reset_rotation3d! throws an ArgumentError, since a beam has no orientation.
To support the kinematic API, a subtype additionally implements one of the following:
_component_beams: for beams made up of componentBeams (e.g.GaussianBeamlet), returns a tuple of these beams. The generictranslate3d!/rotate3d!then delegate to them.translate3d!(::Movable, beam, offset)androtate3d!(::Movable, beam, R::AbstractMatrix): for beams that store rays directly (e.g.Beam), move the start ray(s) via the ray verbs.
BeamletOptics.AbstractBeamGroup Type
AbstractBeamGroupProvides a generic container type interface for bundles of Beams. This interface assumes that there exists a central beam around which the bundle propagates, e.g. akin to an optical axis.
AbstractBeamGroup implementation reqs.
Subtypes of AbstractBeamGroup must implement the following:
Fields:
beams: a vector or tuple of rootAbstractBeams, e.g.Beams orAstigmaticGaussianBeamletscenter: aPoint3{T}which is regarded as the source position, i.e. the reference origin (pivot) of the grouporientation: aSMatrix{3,3,T,9}that describes the local coordinate system of the group
The columns of orientation are the local x-, y- and z-axis. They must form a right-handed orthonormal basis, like the orientation of an ObjectGroup. The local y-axis (second column) is the central source direction, i.e. the optical axis of the group. The local x-axis (first column) is the reference vector of the azimuthal sampling (the basis of the source constructors). Unlike a direction vector, the orientation therefore also tracks a roll of the group about its own optical axis.
Since the kinematic API modifies center and orientation, the subtype must be a mutable struct.
Functions:
If the fields above do not exist, the following getters/setters must be dispatched:
beams: getter for thebeamsfield or equivalent return typeposition/position!: gets or sets the source position (pivot)orientation/orientation!: gets or sets the orientation matrixwavelength: getter for the common wavelength of the beam bundle
The central source direction is derived from the orientation via direction.
Kinematic
An AbstractBeamGroup is a container: it takes the kinematic class of its beams, i.e. BeamletOptics.Movable with an BeamletOptics.Oriented frame for movable beams, see BeamletOptics.AbstractKinematicTrait. The constructors check that the beams are either all static or all movable. The following logic is applied to
translate3d!: all beams and the groupcenterare translated by the offset vectorrotate3d!: all beams are rotated around thecenterpoint with respect to their relative position,orientationis rotatedreset_translation3d!/reset_rotation3d!: moves the group back to the origin or its standard orientation (identity: the central source direction/optical axis is the global +y-axis and the azimuthal sampling reference vectorbasisis the global +x-axis); the beams are always reset, even if the group is already at the identityset_pivot3d!: moves the groupcenter(the pivot used above) without moving or resetting thebeams
Except for set_pivot3d!, every command resets each beam to its untraced start state.
BeamletOptics.AbstractBeamletHit Type
AbstractBeamletHitStores beamlet hits. Currently implemented:
sourceBeamletOptics.AbstractBeamsplitter Type
AbstractBeamsplitter <: AbstractObjectA generic type to represent an AbstractObject that splits incoming beams by reflection and transmission.
Implementation reqs.
Subtypes of AbstractBeamsplitter should implement all supertype requirements.
Interaction logic
After intersection with the AbstractShape at which the beam splitting occurs, the interact3d function should appended the transmitted and reflected sub-beams to the parent beam via the children! function. The interact3d function should then return nothing in order to stop the tracing of the parent beam.
Appending convention
As a convention, when splitting an incoming beam, the order of children appended to the parent beam should be
transmitted beam
reflected beam
Functions
interact3d: see above_beamsplitter_transmitted_beam: optional helper function_beamsplitter_reflected_beam: optical helper function
BeamletOptics.AbstractCompositeSDF Type
AbstractCompositeSDF{T} <: AbstractSDF{T}Generic supertype for boolean composite SDFs, i.e. SDFs that combine two or more AbstractSDF operands into a single shape. Owns the field layout and pivot-aware kinematics shared by all boolean composites; concrete subtypes only need to define the boolean combination semantics (sdf, normal3d, thickness).
Implementation reqs.
Subtypes of AbstractCompositeSDF should implement all reqs. of AbstractSDF as well as the following:
Fields
dir::SMatrix{3, 3, T, 9}: the composite's own orientation matrixtransposed_dir::SMatrix{3, 3, T, 9}: transpose ofdirpos::Point3{T}: the composite's own position, in that field order, and the struct must bemutablesince every setter inAbstractShape.jl/AbstractSDF.jlassigns fields directly
Functions
operands: returns aTupleof every childAbstractSDF, in any ordersdf,normal3dandthicknessspecific to the boolean combination
BeamletOptics.AbstractCylindricalSurfaceSDF Type
AbstractCylindricalSurfaceSDF <: AbstractLensSDF{T}A class of AbstractSDFs that can be used to represent cylindric non-rotationally symmetric lens surfaces. It is implicity assumed that all surfaces are represented by closed volumes for ray-tracing correctness.
Implementation reqs.
Subtypes of AbstractCylindricalSurfaceSDF must implement the following additional methods.
Functions:
height: this function returns the height of the cylinder part of the surfaceradius: this function returns the radius of the cylinder surface curvature
BeamletOptics.AbstractDetector Type
AbstractDetector <: AbstractObjectA generic representation of a detector that evaluates AbstractBeam data during and/or after interaction. Refer to e.g. Detector for more information.
Implementation reqs.
Subtypes of AbstractDetector should implement all supertype requirements as well as:
Functions
interact3d: see e.g.Detectorfor referenceempty!: resets data stored in the detector, see below
Additional information
The information provided below applies to the standard functional implementation of this type and may be overwritten by specialized subtypes.
Data mutability
In order to model field superposition effects, the concrete implementation of an AbstractDetector should be a mutable struct with a constant shape field. This is necessary, since (sub-)beams will interact sequentially with the detector during solve_system!. Only if the data can be accumulated sequentially, multiple beam interactions can be captured for a complex system, e.g. an interferometer.
Data reset
Since e.g. E-field data is supposed to be accumulated by mutability of the detector data, the burden of resetting the data for a new solver call is placed on the user. This function should be called empty!.
BeamletOptics.AbstractDetectorHit Type
AbstractDetectorHitAbstract supertype for all Detector hit records.
A hit of this type encapsulates the interaction of a ray or beamlet with the Detector surface. Instead of directly accumulating values (e.g. optical power), the hit object stores all relevant information about the incident field for a posteriori evaluation (such as plotting, power integration, or polarization analysis).
Info
Note that new subtypes of AbstractDetectorHit must be manually added to the Detector definition to be eligible.
Concrete subtypes include:
RayHit— unpolarized geometric rayPolarizedRayHit— ray carrying a polarization stateGaussianBeamletHit— single Gaussian beamlet
BeamletOptics.AbstractInteraction Type
AbstractInteractionDescribes how an AbstractBeam and an AbstractObject interact with each other. This data type stores information from the interact3d function and provides it to the solver. The solver can use this data to extend the AbstractBeam.
Implementation reqs.
Subtypes of AbstractInteraction must implement the following:
Fields
hint: a nullableHintfor the solver (optional but recommended)
Beam data
It is required that concrete implementations of this type provide some form of data on how to extend the beam. For instance, refer to theBeamInteraction and GaussianBeamletInteraction.
BeamletOptics.AbstractJonesPolarizer Type
AbstractJonesPolarizer <: AbstractObjectRepresents infinitesimally thin components that change the polarization state of incoming PolarizedRays via global Jones matrix calculus. Rather than using the generic Yun ray tracing scheme as referred to in the PolarizedRay docs, this element interacts with the global E-field vector E0 by using a GlobalJonesBasis and projecting the entries into the transverse plane defined by the incoming ray direction and orthogonal E-field vector. This approach is partially inspired by the publication:
Jan Korger et al., "The polarization properties of a tilted polarizer," Opt. Express 21, 27032-27042 (2013)
Warning
It is assumed that the ray direction of propagation is not changed during the interaction.
Implementation reqs.
Subtypes of AbstractJonesPolarizer should implement all supertype requirements.
Interaction logic
The GlobalJonesBasis tracks the rotation in 3D-space via the orientation of the attached AbstractShape. The polarization matrix P is calculated by projecting the previous matrix into the incoming orthogonal plane of polarization. Refer to the _calculate_global_E0 implementation for more information.
Info
The validity of this approach is still under consideration for non-normal incidence.
BeamletOptics.AbstractKinematicFrame Type
Reference frame of a Movable value, either Oriented or Directed.
BeamletOptics.AbstractKinematicTrait Type
The kinematic trait defines whether an entity can be moved by the kinematic API (translate3d!, rotate3d!, ...). It is returned by kinematic_trait_of and follows the same dispatch pattern as AbstractShapeTrait: every public function e.g. translate3d!(x, args...) forwards to translate3d!(kinematic_trait_of(x), x, args...).
Two traits are defined:
Static:xcannot be moved, every kin. function throws anArgumentErrorMovable:xcan be moved; its frame (OrientedorDirected) selects orientation- or direction-based behaviour
A subtype of a movable abstract type can opt out of the kinematic API by declaring its own kinematic_trait_of method, e.g.
struct FixedMirror{T, S <: AbstractShape{T}} <: AbstractObject{T}
shape::S
end
kinematic_trait_of(::FixedMirror) = Static()Every kinematic function on a FixedMirror now throws an ArgumentError; its getters (position, orientation, ...) stay available.
Containers
All members of a container (ObjectGroup, UnionSDF/DifferenceSDF, AbstractBeamGroup) must be either all Static or all Movable. Frames can still be mixed. This must be checked in the respective constructors; nesting is then covered because a nested container already has a uniform class from its own constructor. The container then takes that class: Static if all members are Static, else Movable(Oriented()). All shapes returned by shape(object) of a MultiShape object must be movable, since MultiShape objects (e.g. a CubeBeamsplitter) have no shared constructor to enforce this.
BeamletOptics.AbstractLensSDF Type
AbstractLensSDFA class of AbstractSDFs that can be used to represent rotationally symmetric lens surfaces. It is implicity assumed that all surfaces are represented by closed volumes for ray-tracing correctness.
Implementation reqs.
Subtypes of AbstractLensSDF must implement the following:
Functions:
thickness: this function returns the material thickness of the element along its symmetry axisdiameter: this function returns the outer diameter of the element
Shape orientation
For easy compatibility between subtypes, the follwing requirements should be fulfilled:
Symmetry axis aligned onto the y-axis
Surface contour aligned towards negative y-values
Surface point with
min(y)should satisfymin(y) = 0on the symmetry axis
BeamletOptics.AbstractMesh Type
AbstractMesh <: AbstractShapeA generic type for an shape whose volume can be described by a mesh. Must have a field mesh of type Mesh. See also Mesh{T}.
BeamletOptics.AbstractObject Type
AbstractObjectA generic type for 2D/3D objects that can be used to model optical elements. The geometry of the object is represented via an AbstractShape. The optical effect that occurs between the object and an incoming ray/beam of light is modeled via its interact3d method.
Implementation reqs.
Subtypes of AbstractObject must implement the following:
Shape trait
An AbstractObject can consist of a single AbstractShape, e.g. a lens element, or a collection of functionally dependant shapes, e.g. a cube beamsplitter. In order to model this, the API implementation of an AbstractObject requires the definition of the shape trait. This trait allows the dispatch onto specialized methods to handle the kinematic interface and tracing methods for objects consisting of one or more shapes.
shape_trait_of: defines the shape type of theAbstractObject, refer toAbstractShapeTraitfor more information
Default shape trait
Unless specified otherwise, the shape_trait_of an AbstractObject is defined as SingleShape. This requires object.shape as a dedicated field. For MultiShapes the getter function shape(object) must return a tuple of all shapes that make up the object.
Getters/setters
All kinematic functions defined for the AbstractShape can also be called for a AbstractObject. In this case, the shape trait will define how the specific movement function is dispatched.
Kinematic
AbstractObjects are BeamletOptics.Movable with an BeamletOptics.Oriented frame, see BeamletOptics.AbstractKinematicTrait. The primitives translate3d!(::Movable, object, offset) and rotate3d!(::Movable, object, R::AbstractMatrix) forward to the shape trait. A subtype can opt out of the kinematic API via BeamletOptics.kinematic_trait_of(::Foo) = BeamletOptics.Static().
Functions:
interact3d: defines the optical interaction, the return type must beNothingor anAbstractInteraction
BeamletOptics.AbstractObjectGroup Type
AbstractObjectGroup <: AbstractObjectContainer type for groups of optical elements, based on a tree-like data structure. Intended for easier kinematic handling of connected elements. See also ObjectGroup for a concrete implementation.
Implementation reqs.
Subtypes of AbstractObjectGroup must implement the following:
Fields:
objects: stores objects or additional subgroups of objects, allows for hierarchical structures
Functions:
- for the kinematic API, all corresponding functions of
AbstractObjectmust be implemented
BeamletOptics.AbstractPlateBeamsplitter Type
A generic type to represent an AbstractBeamsplitter that consists of a substrate with a single coated face at which a beam splitting interaction occurs.
Implementation reqs.
Subtypes of AbstractPlateBeamsplitter should implement all supertype reqs. as well as:
Fields
coating: aThinBeamsplitterthat represents the splitter coatingsubstrate: aPrismthat represents the substrate
Getters/setters
If the concrete implementation does not define the above fields, the following getters must be defined:
coating: returns aThinBeamsplittersubstrate: returns aPrism
Additional information
Object orientation
This interact3d method of this type strongly assumes that the coating is positioned directly upon a single face of the substrate with a 100% fill factor.
Interaction logic
This type uses the Hint-API in order to ensure that the splitting interaction is correctly triggered at the coating.
BeamletOptics.AbstractRay Type
AbstractRay{T<:Real}An implementation for a geometrical optics ray in R³. In general, a AbstractRay is described by AbstractRays are intended to model the propagation of light between optical interactions according to the laws of geometrical optics. To store the result of a ray tracing solution, refer to AbstractBeam.
Intersections:
Since the length of a ray can not be known before solving an optical system, the Intersection-type is used. This Nullable type can represent the intersection with an optical element, or lack thereof.
Implementation reqs.
Subtypes of AbstractRay must implement the following:
Fields:
pos: a R³-vector that stores the current positiondir: a R³-vector that stores the current directionintersection: aNullablefield that stores the current [Intersection] ornothingλ: wavelength in [m]n: refractive index along the ray path
Functions:
empty!: resets the ray to its initial, unsolved stateintersect3d: calculates theIntersectionbetween a ray and a shaperotate3d!(::Movable, ray, R::AbstractMatrix): only required for subtypes carrying direction-dependent data (e.g. field vectors); must rotate this data together with the ray direction and clear the intersection
Kinematic API:
AbstractRays are BeamletOptics.Movable with a BeamletOptics.Directed frame, see BeamletOptics.AbstractKinematicTrait. Every verb clears the ray Intersection, i.e. resets the ray to its unsolved state. Rotations are applied about the ray start position. reset_rotation3d! throws an ArgumentError, since a ray has no orientation.
Additional information
Ray length
Base.length: this function is used to return the length of the AbstractRay (if no intersection exists, the ray length is Inf). The opl keyword can be used to obtain the optical path length instead.
Ray direction
Many functions assume that the direction vector has unit length (i.e.
BeamletOptics.AbstractRayHit Type
AbstractRayHit{T} <: AbstractDetectorHitAbstract supertype for detector hits produced by AbstractRays. Provides a common interface for extracting positional and optical path information from rays stored in a detector hit. Currently the following concrete types are implemented:
Implementation reqs.
Subtypes of AbstractRayHit must implement the following:
Fields
ray: stores theAbstractRaythat has intersected the detectoropl: stores theoptical_path_lengthof the parent beam (incl. the ray)
Functions
The interface provides the following functions for the fields above:
position: returns theraypositiondirection: returns theraydirectionlength: returns theraylengthoptical_path_length: returns theoplwavenumber: returns theraywavenumberhit_point: returns the R³ point of intersectionprojection_factor: returns the scalar projection between the surface normal and ray dir.
BeamletOptics.AbstractReflectiveOptic Type
A generic type to represent an [AbstractObject] which reflects incoming rays.
Implementation reqs.
Subtypes of AbstractReflectiveOptic should implement all supertype reqs. as well as:
Fields
- no specific fields required
Getters/setters
- none required
Functions
interact3d: the interaction logic should be akin toreflection3dfor each surface crossing
Additional information
The information provided below applies to the standard functional implementation of this type and may be overwritten by specialized subtypes.
Polarization ray tracing
Fresnel coefficients during reflection are set such that no reflection losses occur (i.e. |rₚ| = |rₛ| = 1).
BeamletOptics.AbstractRefractiveOptic Type
A generic type to represent an AbstractObject that refracts incoming rays.
Implementation reqs.
Subtypes of AbstractRefractiveOptic should implement all supertype reqs. as well as:
Fields
n: a callable field which returns theRefractiveIndexfor a wavelengthλ
Getters/setters
refractive_index: gets the ref. index data of the optic
Functions
interact3d: the interaction logic should be akin torefraction3dfor each surface crossing
Additional information
The information provided below applies to the standard functional implementation of this type and may be overwritten by specialized subtypes.
Uniform ref. index
It is assumed that the optic consists of a single transparent material with a homogeneous refractive index n. It does not consider coated surfaces.
Polarization ray tracing
Fresnel coefficients at the point of refraction are calculated via the fresnel_coefficients function with the refractive index data of the substrate and the previous medium.
BeamletOptics.AbstractRotationallySymmetricSurface Type
AbstractRotationallySymmetricSurface{T} <: AbstractSurface{T}A surface type which is rotationally symmetric around one axis.
Implementation reqs.
Subtypes of AbstractShape should implement the following:
Getters/setters
radius: Returns the radius of curvature of theAbstractRotationallySymmetricSurfacediameter: Returns the clear optical diameter of theAbstractRotationallySymmetricSurfacemechanical_diameter: Returns the mechanical diameter of theAbstractRotationallySymmetricSurfaceedge_sag: Returns the edge sagitta of theAbstractRotationallySymmetricSurface
Functions:
sdf(::AbstractRotationallySymmetricSurface, ::Union{Nothing, AbstractOrientationType}): Converts the surface specification ofAbstractRotationallySymmetricSurfaceinto anAbstractSDF
BeamletOptics.AbstractSDF Type
AbstractSDF <: AbstractShapeProvides a shape function based on signed distance functions. See https://iquilezles.org/articles/distfunctions/ for more information.
Implementation reqs.
Subtypes of AbstractSDF should implement all reqs. of AbstractShape as well as the following:
Functions
sdf(::AbstractSDF, point): a function that returns the signed distance for a point in 3D space
BeamletOptics.AbstractShape Type
AbstractShape{T<:Real}A generic type for a shape that exists in 3D-space. Must have a position and orientation. Types used to describe the geometry of a shape should be subtypes of Real.
Implementation reqs.
Subtypes of AbstractShape should implement the following:
Fields:
pos: a 3D-vector that stores the currentpositionof the object-specific coordinate systemdir: a 3x3-matrix that represents the orthonormal basis of the object and therefore, theorientation
Getters/setters
position/position!: gets or sets theposition vector of theAbstractShapeorientation/orientation!: gets or sets the orientation matrix of theAbstractShape
Kinematic:
AbstractShapes are BeamletOptics.Movable with an BeamletOptics.Oriented frame, see BeamletOptics.AbstractKinematicTrait. The default primitives translate3d!(::Movable, shape, offset) and rotate3d!(::Movable, shape, R::AbstractMatrix) act on position/orientation; subtypes with additional geometry data (e.g. mesh vertices) dispatch their own.
Ray Tracing:
intersect3d: returns the intersection between anAbstractShapeandAbstractRay, or lack thereof. See alsoIntersection
Rendering (with Makie):
Refer to the render! documentation.
BeamletOptics.AbstractShapeTrait Type
AbstractShapeTraitThe shape trait defines how many shapes an AbstractObject consists of. Two different traits are defined:
SingleShape: theAbstractObjectconsists of a singleAbstractShapeMultiShape: theAbstractObjectconsists of two or moreAbstractShapes
Refer to the respective documentation for more information
sourceBeamletOptics.AbstractSphericalSurfaceSDF Type
AbstractSphericalSurfaceSDF{T} <: AbstractSDF{T}An abstract type for SDF-based volumes which represent spherical lens surfaces, i.e. ConvexSphericalSurfaceSDF or ConcaveSphericalSurfaceSDF.
Implementation reqs.
Subtypes of AbstractSphericalSurfaceSDF should implement all supertype reqs. as well as the following:
Fields:
radius: the radius of curvaturediameter: the lens outer diametersag: the lens sagitta
Lens construction
It is intended that practical lens shapes are constructed from AbstractSphericalSurfaceSDFs using the UnionSDF type.
BeamletOptics.AbstractSurface Type
AbstractSurface{T}A generic type for a surface which is basically an information storage type in order to build shapes (volumes) from a combination of surfaces.
sourceBeamletOptics.AbstractSystem Type
AbstractSystemA generic representation of a system of optical elements.
Implementation reqs.
Subtypes of AbstractSystem must implement the following:
Fields:
objects: a vector or tuple ofAbstractObjects that make up the systemn: (optional)RefractiveIndexof the surrounding medium, default value is 1.0
Functions:
refractive_index: returns theRefractiveIndexnof the system medium, see above
BeamletOptics.AconcaveCylinderSDF Type
AconcaveCylinderSDF{T} <: AbstractAcylindricalSurfaceSDF{T}Implements the SDF of a concave cylinder with radius r, diameter d and height h.
BeamletOptics.AconcaveCylinderSDF Method
AconcaveCylinderSDF(radius, diameter, height)Constructs an aconcave cylinder cutout with radius r, diameter d and height h in [m]. The acylindric shape is defined by its conic_constant and the coefficients for the even aspheric polynomoial.
BeamletOptics.AconvexCylinderSDF Type
AconvexCylinderSDF{T} <: AbstractAcylindricalSurfaceSDF{T}Implements the SDF of a cut cylinder with radius r, diameter d and height h.
BeamletOptics.AconvexCylinderSDF Method
AconvexCylinderSDF(radius, diameter, height)Constructs an aconvex cylinder with radius r, diameter d and height h in [m]. The acylindric shape is defined by its conic_constant and the coefficients for the even aspheric polynomoial.
BeamletOptics.AcylindricalSurface Type
AcylindricalSurface{T} <: AbstractAcylindricalSurface{T}A type representing an acylindric optical surface defined by its radius of curvature, diameter, height, mechanical diameter, conic constant and even aspheric coefficients. It is therefore a cylindric surface with a deviation from the perfect cylindric shape.
Fields
radius::T: The radius of curvature of the curved surface.diameter::T: The clear (optical) aperture of the surface.height::T: The height/length of the uncurved surface directionconic_constant::T: The conic_constant of the curved surfacecoefficients::Vector{T}: The coefficients of the even aspherical equation for the curved surface.mechanical_diameter::T: The overall mechanical diameter of the surface. In many cases, this is equal to the optical diameter, but it can be set independently if the mechanical mount requires a larger dimension.
BeamletOptics.AcylindricalSurface Method
AcylindricalSurface(radius, diameter, height, conic_constant, coefficients)Construct a CylindricalSurface given the radius of curvature, optical diameter and height. This constructor automatically sets the mechanical diameter equal to the optical diameter.
Arguments
radius: The radius of curvature of the curved surface.diameter: The clear (optical) diameter of the surface.height: The height/length of the uncurved surface direction.conic_constant::T: The conic_constant of the curved surfacecoefficients::Vector{T}: The coefficients of the even aspherical equation for the curved surface.
BeamletOptics.AstigmaticBeamGroup Type
AstigmaticBeamGroup{T, R} <: AbstractBeamGroup{T, R}A generic container for groups of AstigmaticGaussianBeamlets.
Fields
beams: vector of all beamletscenter: source position, pivot for rotationsorientation: right-handed orthonormal matrix, columns are the sampling reference vector, the central source direction and their cross product, seeAbstractBeamGroup
BeamletOptics.AstigmaticBeamGroup Method
AstigmaticBeamGroup(beams, pos, dir::AbstractVector)
AstigmaticBeamGroup(beams, pos, orientation::AbstractMatrix)Wraps existing beams into an AstigmaticBeamGroup with the source position pos. The group orientation is either derived from the central direction dir (the sampling reference vector is then picked deterministically via normal3d), or passed explicitly as a right-handed orthonormal 3x3 orientation matrix whose second column is the central direction. An invalid orientation throws an ArgumentError.
BeamletOptics.AstigmaticGaussianBeamlet Type
AstigmaticGaussianBeamlet(position, direction, λ, w0; kwargs...)Constructs an astigmatic Gaussian beamlet at its waist with the specified beam parameters. In the 4-argument version, the beam has circular symmetry with waist radius w0. In the 5-argument version, independent waists w0_x and w0_y can be specified.
Arguments
Inputs
position: origin of the beamletdirection: direction of the beamletλ: wavelength of the beamlet in [m]. Default value is 1000 nm.w0: beam waist (radius) in [m]. Default value is 1 mm.w0_x,w0_y: independent beam waists in [m].
Keyword Arguments
M2,M2_x,M2_y: beam quality factors. Default is 1P0: beam total power in [W]. Default is 1 mW.E0: electric field vector in [V/m]. Default isnothing(aligned with support axes, scaled byP0).support: optional support vector for basis constructionz0: beam waist offset in [m]. Default is 0 m
Additional information
Optical invariant check
When using the solve_system! function, the beamlet invariant will be checked for each interaction. If the invariant is violated, tracing will be stopped.
BeamletOptics.AstigmaticGaussianBeamlet Type
AstigmaticGaussianBeamlet{T} <: AbstractBeam{T, PolarizedRay{T}}Complex ray representation of a general astigmatic Gaussian beam as per the formalism described by A. Greynolds (1986) and N. Worku (2017). The beam is described by a chief PolarizedRay and 8 auxiliary Rays that encode the waist radius and divergence in two orthogonal transverse axes. The beam quality M2 is considered via the divergence angle. All equations are based on the following publications:
Alan Greynolds, "Vector formulation of the ray-equivalent method for general Gaussian beam propagation." Curr. Dev. Opt. Eng. Diffraction Phenom. Vol. 679. SPIE, 1986
and
Norman Worku and Herbert Gross, "Vectorial field propagation through high NA objectives using polarized Gaussian beam decomposition." OTOM XIV. Vol. 10347. SPIE, 2017
Fields
c: chiefBeamofPolarizedRaysparent: reference to the parent beam (ornothing)children: vector of child beams (e.g. after beam-splitting)
Additional information
Waist and field calculation
For a given beamlet the Gaussian beam parameters can be obtained via the gauss_parameters function.
BeamletOptics.AstigmaticGaussianBeamlet Method
AstigmaticGaussianBeamlet(position, direction, λ, w0_x, w0_y; kwargs...)Constructs an astigmatic Gaussian beamlet with independent waists w0_x and w0_y. This constructor supports modeling astigmatic sources where the waists in X and Y are at different locations along the beam axis.
Arguments
position: Global reference point of the beamlet.direction: Propagation direction vector.λ: Wavelength.w0_x: Waist radius in the X direction (defined by the support vector).w0_y: Waist radius in the Y direction.
Keyword Arguments
z0_x: Position of the X waist relative topositionalong the propagation axis. Defaults toz0.z0_y: Position of the Y waist relative topositionalong the propagation axis. Defaults toz0.z0: Default waist position ifz0_xandz0_yare not specified. Also defines the starting point of the chief ray asposition + z0 * direction.M2_x,M2_y: Beam quality factors. Default is 1.P0: Total power in [W].E0: Optional Jones vector for polarization.support: Optional vector orthogonal todirectionto define the X axis.
Additional information
Optical invariant check
When using the solve_system! function, the beamlet invariant will be checked for each interaction. If the invariant is violated, tracing will be stopped.
BeamletOptics.AstigmaticGaussianBeamletHit Type
AstigmaticGaussianBeamletHit{T} <: AbstractBeamletHit{T}Stores an [AstigmaticGaussianBeamlet], where l0 represents the length of the parent beam up until the current beam section, identified by the id index.
BeamletOptics.AstigmaticGaussianBeamletInteraction Type
Stores the interaction result for all 9 component beams of an AstigmaticGaussianBeamlet. Uses the hint from the chief beam interaction.
Fields
chief:BeamInteractionfor the chief raywxp,wxm,wyp,wym: waist beam interactionsdxp,dxm,dyp,dym: divergence beam interactions
BeamletOptics.Beam Type
Beam{T, R <: AbstractRay{T}} <: AbstractBeam{T, R}Stores the rays that are calculated from geometric optics when propagating through an optical system. The Beam type is parametrically defined by the AbstractRay subtype that it stores.
Fields
rays: vector ofAbstractRayobjects, representing the rays that make up the beamparent: reference to the parent beam, if any (Nullableto account for the root beam which has no parent)children: vector of child beams, each child beam represents a branching or bifurcation of the original beam, i.e. beam-splitting
BeamletOptics.Beam Method
Beam(pos, dir, λ, E0)Spawns a Beam of PolarizedRays at the start position in the specified direction with the wavelength λ and electric field vector E0
BeamletOptics.Beam Method
Beam(pos, dir, λ, E0)Spawns a Beam at the start position in the specified direction with the wavelength λ and field vector E0.
BeamletOptics.Beam Method
Beam(pos, dir, λ=1e-6)Spawns a Beam at the start position in the specified direction with the wavelength λ = 1000 nm.
BeamletOptics.BeamInteraction Type
BeamInteraction <: AbstractInteractionThis type is used to store the new AbstractRay resulting from on optical interaction between a Beam and some AbstractObject.
Fields
hint: optionalHintfor the solverray: newAbstractRayresulting from the interaction
BeamletOptics.BoxSDF Type
BoxSDF <: AbstractSDFImplements the box SDF with edge lengths x, y, and z. Note that these values are stored in the dimensions field as:
dimensions::Point3 = ( len_in_x/2, len_in_y/2, len_in_z/2,
)
sourceBeamletOptics.BoxSDF Method
BoxSDF(x, y, z)Creates a BoxSDF with:
x: x-dir. edge length in [m]y: y-dir. edge length in [m]z: z-dir. edge length in [m]
BeamletOptics.CircularFlatSurface Type
CircularFlatSurface{T} <: AbstractRotationallySurface{T}A type representing a planar circular surface, which is only parametrized by its diameter.
Fields
diameter::T: The diameter of the planar surface
BeamletOptics.CollimatedSource Type
CollimatedSource <: AbstractBeamGroupRepresents a parallel bundle of Beams being emitted from a disk in space.
Fields
beams: a vector of allBeams originating from the sourcediameter: the diameter of the outermost beam ringcenter: source position, pivot for rotationsorientation: right-handed orthonormal matrix, columns are the sampling reference vector, the central source direction and their cross product, seeAbstractBeamGroup
Functions
diameter: returns the diameter of the source
BeamletOptics.CollimatedSource Method
CollimatedSource(pos, dir, diameter, λ; num_rings, num_rays, basis)Spawns a bundle of collimated Beams at the specified position and direction. The source is modelled as a ring of concentric beam rings around the center beam. The amount of beam rings between the center ray and outer diameter can be specified via num_rings.
Info
Note that for correct sampling, the number of rays should be atleast 20x the number of rings.
Arguments
The following inputs and arguments can be used to configure the CollimatedSource:
Inputs
pos: center beam starting positiondir: center beam starting directiondiameter: outer beam bundle diameter in [m]λ = 1e-6: wavelength in [m], default val. is 1000 nm
Keyword Arguments
num_rings: number of concentric beam rings, default is 10num_rays: total number of rays in the source, default is 100x num_ringsbasis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle for the beam rings.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors spanning the pupil plane are derived from dir deterministically, so two sources sharing the same dir, diameter, num_rings and num_rays sample exactly the same ray positions. Pass a basis to rotate the azimuthal sampling of a source about its own axis, e.g. to interleave several otherwise identical sources.
BeamletOptics.CollimatedSource Method
CollimatedSource(beams, diameter, pos, dir::AbstractVector)
CollimatedSource(beams, diameter, pos, orientation::AbstractMatrix)Wraps existing beams into a CollimatedSource with the given diameter and the source position pos. The group orientation is either derived from the central direction dir (the sampling reference vector is then picked deterministically via normal3d), or passed explicitly as a right-handed orthonormal 3x3 orientation matrix whose second column is the central direction. An invalid orientation throws an ArgumentError.
BeamletOptics.ConcaveAsphericalSurfaceSDF Type
Constructs an aspheric lens with a concave-like surface according to ISO10110.
Note
Currently, it is assumed that the aspheric surface is concave if the radius is negative. There might be unexpected effects for complex shapes which do not show a generally concave behavior.
coefficients: (even) coefficients of the asphere.radius: radius of the lens (negative!)conic_constant: conic constant of the lens surfacediameter: lens diametermechanical_diameter: mechanical lens diameter, defaults to be identical to the lens diameter, Otherwise an outer ring section will be added to the lens, ifmechanical_diameter>diameter.
BeamletOptics.ConcaveCylinderSDF Type
ConcaveCylinderSDF <: AbstractSDFImplements the SDF of a concave cylinder with radius r, diameter d and height h.
BeamletOptics.ConcaveCylinderSDF Method
ConcaveCylinderSDF(radius, diameter, height)Constructs a concave cylinder with radius r, diameter d and height h in [m].
BeamletOptics.ConcaveSphericalSurfaceSDF Type
AbstractSDF-based representation of a concave spherical lens surface. When constructed, it is assumed that the plano-surface lies at the origin and the optical axis is aligned with the y-axis. The concave surface is orientated towards negative y-values for R > 0 and vice versa.
Fields:
radius: the radius of curvature of the convex spherical surface.diameter: the outer diameter of the lens surfacesag: the sagitta of the opposing convex shape
BeamletOptics.ConcaveSphericalSurfaceSDF Method
Constructs a ConcaveSphericalSurfaceSDF with a specific radius of curvature and lens outer diameter.
BeamletOptics.ConicSDF Type
ConicSDF{T} <: AbstractSDF{T}Signed distance function representation of a segment of a conic of revolution (sphere, paraboloid, prolate/oblate ellipsoid or hyperboloid), used as the substrate of ParabolicMirror, ConicMirror, EllipsoidalMirror, HyperbolicMirror and their OffAxis* twins.
Frame convention
The origin is the segment centre, lying on the reflecting surface.
The parent optical axis is parallel to the local y-axis, offset by
x_offalong the negative x-axis; there is no tilt between the segment and its parent axis.A concave surface (
R > 0) opens towards the negative y-axis; a convex surface (R < 0) opens towards the positive y-axis.The parent vertex lies at
(-x_off, +Z(x_off), 0), whereZis the sag function of the parent conic.For
x_off = 0andk = -1,R = 2f: the vertex lies at the origin and the (real) focus lies at(0, -f, 0). This on-axis case needs no separate type:x_off = 0is an ordinary argument value, not a differentConicSDFvariant.
Fields
f: paraxial focal length of the parent conic,R/2[m]k: conic constant (k = -1paraboloid,k = 0sphere,-1 < k < 0prolate ellipsoid,k > 0oblate ellipsoid,k < -1hyperboloid)x_off: off-axis distance from the parent vertex to the segment centre [m]diameter: segment aperture diameter [m]thickness: substrate thickness in y-direction [m]pos: position point in world coordinates [m]dir: rotation matrix in world coordinatestransposed_dir: transposed rotation matrix
Surface equation
With r_p = sqrt((x + x_off)^2 + z^2) the parent radius and
the reflecting surface is y_surf(x, z) = -(Z(r_p) - Z(x_off)). The substrate is the solid {y_surf <= y <= thickness, sqrt(x^2 + z^2) <= diameter/2}.
BeamletOptics.ConicSDF Method
Constructs a ConicSDF representing a segment of a conic of revolution.
Inputs
R: radius of curvature at the parent vertex [m];R > 0is concave (opens towards-y),R < 0is convex (opens towards+y). Must be non-zero.k: conic constant.k = -1is a paraboloid,k = 0a sphere,-1 < k <= 0a prolate ellipsoid,k > 0an oblate ellipsoid,k < -1a hyperboloid.x_off: off-axis distance from the parent vertex to the segment centre [m]diameter: segment aperture diameter [m]. Must be positive.thickness: substrate thickness in y-direction [m]
For k > -1 the parent conic is only defined for r < abs(R)/sqrt(1+k); the constructor throws an ArgumentError if the aperture (abs(x_off) + diameter/2) reaches or exceeds this limit. For k <= -1 the surface is defined for all r, so no such limit applies.
BeamletOptics.ConvexAsphericalSurfaceSDF Type
Constructs an aspheric lens with a convex-like surface according to ISO10110.
Note
Currently, it is assumed that the aspheric surface is convex if the radius is positive. There might be unexpected effects for complex shapes which do not show a generally convex behavior.
coefficients: (even) coefficients of the asphere.radius: radius of the lensconic_constant: conic constant of the lens surfacediameter: lens diameter
BeamletOptics.ConvexCylinderSDF Type
ConvexCylinderSDF <: AbstractSDFImplements the SDF of a cut cylinder with radius r, diameter d and height h.
BeamletOptics.ConvexCylinderSDF Method
ConvexCylinderSDF(radius, diameter, height)Constructs a cut cylinder with radius r, diameter d and height h in [m].
BeamletOptics.ConvexSphericalSurfaceSDF Type
AbstractSDF-based representation of a convex spherical lens surface. When constructed, it is assumed that the plano-surface lies at the origin and the optical axis is aligned with the y-axis. The convex surface is orientated towards negative y-values for R > 0 and vice versa.
Fields:
radius: the radius of curvature of the concave spherical surface.diameter: the outer diameter of the lens surfacesag: the sagitta of the convex shapeheight: the sphere cutoff height, see alsoCutSphereSDF
BeamletOptics.ConvexSphericalSurfaceSDF Method
Constructs a ConvexSphericalSurfaceSDF with a specific radius of curvature and lens outer diameter.
BeamletOptics.CubeBeamsplitter Type
CubeBeamsplitter <: AbstractBeamsplitterA cuboid beamsplitter where the splitting interaction occurs between two RightAnglePrisms. For more information refer to the AbstractPlateBeamsplitter docs.
Fields
front: the forward facing substrate, represented by aRightAnglePrismback: the backward facing substrate, represented by aRightAnglePrismcoating: a rectangularThinBeamsplitterthat represents the splitting interface
Additional information
Hints and interaction logic
In order to model gap-free beam propagation, the interact3d model relies heavily on the Hint-API. If the front or back substrate is hit, the Hint will ensure that the beam intersects the coating.
BeamletOptics.CubeBeamsplitter Method
CubeBeamsplitter(leg_length, n; reflectance=0.5)Creates a CubeBeamsplitter. The cuboid is centered at the origin. The splitter coating is orientated at a 45° angle with respect to the y-axis.
Inputs
leg_length: the x-, y- and z-edge length in [m]n: theRefractiveIndexof the front and back prism
Keywords
reflectance: defines the splitting ratio in [-], i.e. R = 0 ... 1.0
BeamletOptics.CutSphereSDF Type
CutSphereSDF <: AbstractSDFImplements SDF of a sphere which is cut off in the x-z-plane at some point along the y-axis.
sourceBeamletOptics.CutSphereSDF Method
CutSphereSDF(pos, radius, height)Constructs a sphere with radius which is cut off along the y-axis at height.
BeamletOptics.CylinderSDF Type
CylinderSDF <: AbstractSDFImplements cylinder SDF. Cylinder is initially orientated along the y-axis and symmetrical in x-z.
sourceBeamletOptics.CylindricalSurface Type
CylindricalSurface{T} <: AbstractCylindricalSurface{T}A type representing a cylindric optical surface defined by its radius of curvature, diameter, height and mechanical diameter
Fields
radius::T: The radius of curvature of the curved surface.diameter::T: The clear (optical) aperture of the surface.height::T: The height/length of the uncurved surface directionmechanical_diameter::T: The overall mechanical diameter of the surface. In many cases, this is equal to the optical diameter, but it can be set independently if the mechanical mount requires a larger dimension.
BeamletOptics.CylindricalSurface Method
CylindricalSurface(radius::T, diameter::T, height::T) where TConstruct a CylindricalSurface given the radius of curvature, optical diameter and height. This constructor automatically sets the mechanical diameter equal to the optical diameter.
Arguments
radius::T: The radius of curvature of the curved surface.diameter::T: The clear (optical) diameter of the surface.height::T: The height/length of the uncurved surface direction.
BeamletOptics.Detector Type
Spawns a quadratic Detector surface that is aligned with the neg. y-axis. The detector edge length can be configured via edge_length. Additionally, continued tracing can be configured via the stop flag where
falseindicates continued tracingtruestops the incoming beams as with any hard target
BeamletOptics.Detector Type
Detector <: AbstractDetectorRepresents a flat rectangular or quadratic, infinitesimally thin surface in R³. The detector surface is a detection screen that captures incoming ray or beamlet data. The active surface is discretized in the local R² x-y-coordinate system. If configured, beams or beamlets can continue tracing after hitting the detector.
Hits
Hits are represented via the AbstractDetectorHit interface. An empty detector is able to detect any kind of incoming hit, but as soon as the initial hit type has been determined, all following hits must share the same type, i.e. no cross-interaction between hit types is allowed.
Functions
The following functions allow a posteriori evaluation of hit contributions via e.g. f(detector). Refer to the respective function documentation.
Additional information
In general, the detection surface is represented by a flat Mesh that has been rotated such that the surface normals point towards the negative y-axis for the initial positioning. This allows for the definition of a left-handed (x, z) surface coordinate system, where incoming beams intersect against the detector surface normal.
Reset behavior
The Detector must be reset between each call of solve_system! in order to overwrite previous results using the empty! function. Otherwise, the current result will be added onto the previous result.
Moving after solving
Do not move the detector before calculating all parameters of interest for the current system configuration. Since the detector stores pointers to the current system and beam states, silent errors might occur.
Fields
shape: geometry of the active surface, must represent 2D-fieldinxanyydimensions, normal vector direction must adhere to definition abovehits: a union ofNothingand all implementedAbstractDetectorHits, resettable viaempty!(note that only one type is allowed at any time)stop: a boolean value that allows for continued tracing after "passing through" the detectorlock: locks theDetectorfor multithreading-safepush!ing to the hits vector
BeamletOptics.DifferenceSDF Type
DifferenceSDF{T, S, TT <: Tuple} <: AbstractCompositeSDF{T}Represents the boolean subtraction of one or more tools from a base AbstractSDF, i.e. base \ (tool_1 ∪ tool_2 ∪ …). Unlike UnionSDF, the constituent SDFs are required to overlap: the tools must intersect the base for anything to be removed.
The intended way to construct these is not explicitly but by subtracting AbstractSDFs using the regular - operator:
s1 = SphereSDF(1.0)
s2 = SphereSDF(0.5)
translate3d!(s2, Point3(0.5, 0.0, 0.0))
# will result in a sphere with a smaller, off-center sphere carved out of it
s_diff = s1 - s2Non-commutativity and evaluation order
Subtraction is neither commutative nor associative, so a - b and b - a differ, and a chain like a + b - c + d must keep track of when each operand was combined. Repeated subtraction is flattened along its own chain via the identity
so a - b - c produces a single DifferenceSDF with one base and a flat tools tuple, rather than deepening the type on every chained -. Mixed +/- chains still nest (e.g. a + b - c is (a + b) - c, and ... + d afterwards wraps the whole difference in a UnionSDF) — this is what keeps their meaning, since material added after a subtraction must not be carved away by it.
Exactness
Per iquilezles.org/articles/distfunctions, opSubtraction = max(-a, b) is only a bound, not an exact SDF: it under-estimates the true distance near the seam between base and tool. This is the safe direction for sphere tracing — an under-estimate never causes tunneling, it only costs a few extra ray marching iterations near concave creases. Correctness of ray marching hinges on normal3d being resolved by explicit operand selection (as implemented here) rather than by automatic differentiation, which picks the wrong sub-shape at the seam.
BeamletOptics.Directed Type
Directed <: AbstractKinematicFrameReference frame of a movable value that only has a direction but no orientation, e.g. rays and beams.
Implementation reqs.
positiondirection: the direction getter of the type
reset_rotation3d! throws an ArgumentError, use align3d! instead.
BeamletOptics.DiscreteRefractiveIndex Type
DiscreteRefractiveIndex{T}Represents a incomplete set of dispersion data where for each exact wavelength one refractive index value is stored in the data field. Can be called like a function n = n(λ). Does not interpolate between data points. Refer to RefractiveIndex for more information.
BeamletOptics.DiscreteRefractiveIndex Method
DiscreteRefractiveIndex(λs, n)Creates a DiscreteRefractiveIndex dictionary where each wavelength in λs is mapped onto an exact exact refractive index in ns.
Inputs
λs: array of wavelengthsns: array of refractive indices
BeamletOptics.DoubletLens Type
DoubletLensRepresents a two-component cemented doublet lens with two respective refractive indices n = n(λ). See also SphericalDoubletLens.
Fields
Additional information
Air gap
This component type strongly assumes that both lenses are mounted fully flush with respect to each other. Gaps between the components might lead to incorrect results.
BeamletOptics.EvenAsphericalSurface Type
EvenAsphericalSurface{T} <: AbstractRotationallySymmetricSurface{T}A type representing an aspherical optical surface defined by its radius of curvature, clear (optical) diameter, conic constant, aspheric coefficients and mechanical diameter. This surface is rotationally symmetric about its optical axis.
Fields
spherical::SphericalSurface{T}: The base spherical surface portion of the asphere.conic_constant::T: The conic constant defining the deviation from a spherical shape.coefficients::AbstractVector{T}: A vector of even aspheric coefficients for higher-order corrections.
BeamletOptics.EvenAsphericalSurface Method
EvenAsphericalSurface(radius, diameter, conic_constant, coefficients::AbstractVector, mechanical_diameter = diameter)Construct a EvenAsphericalSurface given the radius of curvature, the optical diameter, conic constant, the aspheric coefficients and optionally the mechanical diameter. This constructor automatically sets the mechanical diameter equal to the optical diameter.
Arguments
radius: The radius of curvature of the base spherical surface.diameter: The clear (optical) diameter of the surface.conic_constant: The conic constant defining the deviation from a spherical shape.coefficients::AbstractVector: A vector of even aspheric coefficients for higher-order corrections.mechanical_diameter: The mechanical diameter of the surface; if not provided, it defaults todiameter.
BeamletOptics.GaussianBeamlet Type
GaussianBeamlet{T} <: AbstractBeam{T, Ray{T}}Ray representation of the stigmatic Gaussian beam as per J. Arnaud (1985). The beam quality M2 is fully considered via the divergence angle. The formalism for the beam parameter calculation is based on the following publications:
Jacques Arnaud, "Representation of Gaussian beams by complex rays." Appl. Opt. 24, 538-543 (1985)
and
Donald DeJager and Mark Noethen, "Gaussian beam parameters that use Coddington-based Y-NU paraprincipal ray tracing," Appl. Opt. 31, 2199-2205 (1992)
Fields
λ: beam wavelength in [m]w0: local beam waist radius in [m]E0: complex field value in [V/m]parent: reference to the parent beam, if any (Nullableto account for the root beam which has no parent)children: vector of child beams, each child beam represents a branching or bifurcation of the original beam, i.e. beam-splitting
Additional information
Beam parameters
Parameters of the beam, e.g. gauss_parameters function.
Astigmatism and abberations
It is assumed, but not forbidden, that the optical system contains non-flat or non-parabolic beam-surface-interactions that cause the beam to obtain astigmatism or higher-order abberations. These can not be represented by the GaussianBeamlet.
BeamletOptics.GaussianBeamlet Method
GaussianBeamlet(position, direction, λ, w0; kwargs...)Constructs a Gaussian beamlet at its waist with the specified beam parameters.
Arguments
The following inputs and arguments can be used to configure the beamlet:
Inputs
position: origin of the beamletdirection: direction of the beamletλ: wavelength of the beamlet in [m]. Default value is 1000 nm.w0: beam waist (radius) in [m]. Default value is 1 mm.
Keyword Arguments
M2: beam quality factor. Default is 1P0: beam total power in [W]. Default is 1 mWz0: beam waist offset in [m]. Default is 0 msupport:Nullablesupport vector for the construction of the waist and div rays
Additional information
Waist offset
The z0 keyword arg. can be used in order to spawn a beam where the waist is not located at the specified position, but rather at an offset z0 in [m] along the chief ray axis.
Support vector
In order to calculate the basis vectors required for the beamlet construction, a random orthogonal vector is chosen. If results fluctuate due to the randomness of this vector, make sure to specify a fixed orthogonal support vector.
BeamletOptics.GaussianBeamletHit Type
GaussianBeamletHit{T} <: AbstractBeamletHit{T}Stores a [GaussianBeamlet], where l0 represents the length of the parent beam up until the current beam section, identified by the id index.
BeamletOptics.GaussianBeamletInteraction Type
This type is used to store the new beamlet section resulting from on optical interaction between a GaussianBeamlet and some AbstractObject. Uses the hint of the chief beam.
Fields
sourceBeamletOptics.GlobalJonesBasis Type
GlobalJonesBasis <: AbstractJonesMatrixStores the Jones matrix entries for a polarizing optical element that is aligned with the global y-axis as the optical axis.
sourceBeamletOptics.Hint Type
HintA Hint can be passed as part of an AbstractInteraction and will inform the tracing algorithm about which AbstractObject in the AbstractSystem will be hit next.
Info
The Hint does not need to result in a guaranteed Intersection. However, if the hinted shape is intersected, it will be immediatly assumed as the correct global intersection.
Fields
object: the object that might or will be intersected nextshape: the underlying shape that will be intersected next, i.e.shape(object), relevant for multi-shape objects
BeamletOptics.IntersectableObject Type
IntersectableObjectA passive AbstractObject which can be hit by a beam. In this case, the object acts like a hard target and blocks the beam path.
Fields
shape: anAbstractShape
BeamletOptics.Intersection Type
Intersection{T}Stores data calculated by the intersect3d method. This information can be reused, i.e. for retracing.
Fields:
object: aNullablereference to theAbstractObjectthat has been hit (optional but recommended)shape: aNullablereference to theAbstractShapeof theobjectthat has been hit (optional but recommended)t: length of the ray parametrization in [m]n: normal vector at the point of intersection
BeamletOptics.Lens Type
Lens{T, S <: AbstractShape{T}, N <: RefractiveIndex} <: AbstractRefractiveOptic{T, N}Represents an uncoated Lens with a homogeneous RefractiveIndex n = n(λ). Refer to the Lens and SphericalLens constructors for more information on how to generate lenses.
Fields
shape: geometry of the lens, refer toAbstractShapefor more informationn:RefractiveIndexfunction that returns n(λ)
Additional information
Refractive index
The chromatic dispersion of the lens is represented by a λ-dependent function for n and must be provided by the user. For testing purposes, an anonymous function, e.g. λ -> 1.5 can be passed such that the lens has the same refractive index for all wavelengths.
BeamletOptics.Lens Method
Lens(front_surface::AbstractCylindricalSurface, back_surface::AbstractCylindricalSurface, center_thickness::Real, n::RefractiveIndex)Constructs a new Lens object using the cylindric surface specifications front_surface and back_surface and the center_thickness. These inputs are used to construct a UnionSDF that consists of the appropriate sub-SDFs to represent the shape of the lens.
This method of Lens is specific for cylindric lenses and has some limitations: - The cylinder height of both surfaces has to be identical - No mixture with non-cylindric surfaces is supported at the moment
The material properties are supplied via the n parameter.
Additional information
Radius of curvature (ROC) sign definition
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
BeamletOptics.Lens Method
Lens(front_surface::AbstractRotationallySymmetricSurface, back_surface::AbstractRotationallySymmetricSurface, center_thickness::Real, n::RefractiveIndex)Constructs a new Lens object using the surface specifications front_surface and back_surface and the center_thickness. These inputs are used to construct a UnionSDF that consists of the appropriate sub-SDFs to represent the shape of the lens.
The material properties are supplied via the n parameter.
Additional information
Radius of curvature (ROC) sign definition
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
Meniscus
If your specification results in a meniscus lens, only spherical meniscus lenses are supported at the moment.
BeamletOptics.LinearPolarizer Type
LinearPolarizer{T, N <: RefractiveIndex} <: AbstractObject{T}Represents a real, round linear polarizing film laminated between two uncoated glass plates (e.g. Thorlabs LPNIRE100-B), modeled as a thin PolarizationFilter cemented between two Prism substrates that sit flush against the film. Refer to RoundLinearPolarizer for the constructor.
Fields
filter: the thinPolarizationFilterthat models the polarizing filmfront: front glass substratePrismback: back glass substratePrism
Additional information
Kinematic center
The center of kinematics of this component lies at the center of the film.
Uncoated surfaces
Since the glass substrates are uncoated, a PolarizedRay loses approx. 4 % of its intensity per outer surface at n ≈ 1.5 due to Fresnel reflection, unlike the anti-reflection coated real-world part.
Crossed orientation
When the film orientation is crossed (transmission axis perpendicular to the incident polarization), the beam is terminated at the cemented film interface once the norm of the transmitted electric field falls to or below the cutoff_strength of the underlying PolarizationFilter.
BeamletOptics.LocalJonesBasis Type
LocalJonesBasisStores the s-p-basis Jones matrix coefficients. Must be defined for x-y-aligned elements where z is the optical axis.
sourceBeamletOptics.MeniscusLensSDF Type
MeniscusLensSDFAbstractSDF-based representation of a positive or negative meniscus lens. When constructed, it is assumed that the lens lies at the origin and the optical axis is aligned with the y-axis. Parameters that lead to a sharp lens edge will cause an error.
Notes
Radius of curvature sign convention
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
Fields:
convex: the convex part of the lens composite SDFcylinder: the cylindrical part of the lens composite SDFconcave: the concave part of the lens composite SDFthickness: lens thickness on the optical axis
BeamletOptics.MeniscusLensSDF Method
MeniscusLensSDF(r1::R1, r2::R2, l::L, d::D, md::MD)Constructs a positive or negative MeniscusLensSDF with:
r1: front surface radis or curvaturer2: back surface radis or curvaturel: lens thicknessd: lens diameter, default value is one inchmd: mechanical lens diameter, must be > d
BeamletOptics.Mesh Type
Mesh <: AbstractMeshContains the STL mesh information for an arbitrary shape, that is the vertices that make up the mesh and a matrix of faces, i.e. the connectivity matrix of the mesh. The data is read in using the FileIO.jl and MeshIO.jl packages. Translations and rotations of the mesh are directly saved in absolute coordinates in the vertex matrix. For orientation and translation tracking, a positional and directional matrix are stored.
Fields
vertices: (m x 3)-matrix that stores the edge points of all trianglesfaces: (n x 3)-matrix that stores the connectivity data for all facesdir: (3 x 3)-matrix that represents the current orientation of the meshpos: 3-element vector that is used as the mesh location referencescale: scalar value that represents the current scale of the original mesh
BeamletOptics.Mesh Method
Mesh(mesh)Parametric type constructor for struct Mesh. Takes data of type GeometryBasics.Mesh and extracts the vertices and faces. The mesh is initialized at the global origin. Data type of Mesh is variably selected based on type of vertex data (i.e Float32).
Tip
Mesh vertex data is scaled by factor 1e-3, assuming [m] scale. Ensure that the export program is adjusted accordingly when scaling issues occur.
BeamletOptics.Mirror Type
Mirror{S <: AbstractShape} <: AbstractReflectiveOpticConcrete implementation of a perfect mirror (R = 1) with arbitrary shape.
Reflecting surfaces
It is important to consider that all surfaces of this mirror type are reflecting!
BeamletOptics.MissingBackendError Type
MissingBackendErrorCustom Exception type that indicates that the Makie extension of BeamletOptics has not been loaded correctly.
BeamletOptics.Movable Type
Movable{F <: AbstractKinematicFrame} <: AbstractKinematicTraitRepresents a value that can be moved by the kinematic API. The frame field (Oriented or Directed) selects orientation- or direction-based behaviour of the derived functions.
Rotations are applied about the own position of the value unless a pivot is passed explicitly. A rotation axis can have any non-zero length (it is normalized internally).
Kinematic functions
translate3d!: movesxby anoffsetvector (primitive, implemented per type)rotate3d!: rotatesxby a rotation matrixRaboutposition(x), or about a givenpivotif one is passed (theR-only form is the primitive, implemented per type; the axis/angle and pivot forms are derived from it)translate_to3d!: movesxso thatposition(x)coincides with a target pointxrotate3d!/yrotate3d!/zrotate3d!: rotatexby an angleθ[rad] about the global x-, y- or z-axis throughposition(x)align3d!: rotatesxaboutposition(x)so thatdirection(x)is aligned with a target vectorreset_translation3d!: movesxso thatposition(x)is the global origin; available for everyMovable, including rays, beams and beam groupsreset_rotation3d!: only available forOrientedvalues, where it rotatesxback to identityorientation; forDirectedvalues (rays, beams) it throws anArgumentError, usealign3d!insteaddirection: forOrientedvalues this is the local y-axis,orientation(x)[:, 2];Directedvalues provide their own getter
Sources (rays, beams and beam groups) are additionally reset to their untraced start state by every one of the functions above: a moved but already-traced source would otherwise keep rays or child beams belonging to the old, now geometrically wrong, light path. Moving a beam that is not the root of its beam tree (e.g. one created by a beamsplitter interaction) throws an ArgumentError; move its root beam instead.
Implementation reqs.
If kinematic_trait_of(::Foo) = Movable(...) is declared, Foo must implement the following:
positiontranslate3d!(::Movable, x::Foo, offset): movesxbyoffsetrotate3d!(::Movable, x::Foo, R::AbstractMatrix): rotatesxbyRaboutposition(x)
All other kin. functions listed above are derived from these two primitives.
sourceBeamletOptics.MultiShape Type
MultiShape <: AbstractShapeTraitRepresents that the AbstractObject consists of a two or more AbstractShapes.
AbstractObject implementation reqs.
If shape_trait_of(::Foo) = MultiShape() is defined, Foo must implement the following:
Functions
shape(::Foo): a getter function that returns aTupleof all relevant shapes, e.g.(foo.front, foo.middle, foo.back)
All shapes returned by shape(::Foo) must be movable, see BeamletOptics.AbstractKinematicTrait.
Additional information
Kinematic center
Unless specified otherwise by dispatching position / position! and orientation / orientation! onto custom pos and dir data fields, the position and orientation of the first element returned by shape(object) will be used as the kinematic center for e.g. translate3d!.
BeamletOptics.NonInteractableObject Type
A passive AbstractObject which does not interact with the ray tracing simulation but can be moved via the kinematic API.
Fields
shape: anAbstractShape
Usage
This type is intended mainly for visualization purposes, e.g. kinematic mount Meshs, or similar applications. In essence, this object behaves fully transparent. The intersect3d and interact3d methods default to nothing.
BeamletOptics.ObjectGroup Type
ObjectGroup <: AbstractObjectGroupA tree-like storage container for groups of objects. Can store individual objects and subgroups. Main purpose is handling of, i.e., groups of lenses.
Fields
center: a point in 3D space which is regarded as the reference origin of the groupdir: a 3x3 matrix that describes the commonorientationof the groupobjects: storesAbstractObject, can also store subgroups of typeAbstractObjectGroup
Kinematic
A ObjectGroup implements the kinematic functions of AbstractObject. The following logic is applied to
translate3d!: all objects in the group are translated by the offset vectortranslate_to3d!: all objects are moved in parallel such that the groupcenteris equal to the target positionrotate3d!: all objects are rotated around thecenterpoint with respect to their relative positionset_pivot3d!: moves the groupcenter(the pivot used above) without moving any of itsobjects
The objects must be either all static or all movable, otherwise the constructor throws an ArgumentError. The group takes that kinematic class, see BeamletOptics.AbstractKinematicTrait.
BeamletOptics.Oriented Type
Oriented <: AbstractKinematicFrameReference frame of a movable value with a full local coordinate system, e.g. shapes, objects and beam groups.
Implementation reqs.
position/position!orientation/orientation!: a right-handed orthonormal 3x3 matrix
direction returns the local y-axis, i.e. orientation(x)[:, 2]. reset_rotation3d! rotates x by transpose(orientation(x)) about its position and then sets the orientation to the identity.
BeamletOptics.PlanoSurfaceSDF Type
PlanoSurfaceSDFAbstractSDF-based representation of two flat optical surfaces, i.e. equivalent to the CylinderSDF. When constructed, it is assumed that the first flat surface lies at the origin and the optical axis is aligned with the positive y-axis.
Fields:
diameter: the outer diameter of the circular flat lens surfacethickness: the distance between the flat surfaces
BeamletOptics.PointSource Type
PointSource <: AbstractBeamGroupRepresents a cone of Beams being emitted from a single point in space.
Fields
beams: a vector of allBeams originating from the sourceNA: thenumerical_apertureof the point source spread anglecenter: source position, pivot for rotationsorientation: right-handed orthonormal matrix, columns are the sampling reference vector, the central source direction and their cross product, seeAbstractBeamGroup
Functions
numerical_aperture: returns the NA of the source
BeamletOptics.PointSource Method
PointSource(pos, dir, θ, λ; num_rings, num_rays, basis)Spawns a point source of Beams at the specified position and direction. The point source is modelled as a collection of concentric beam fans centered around the center beam. The amount of beam rings between the center ray and half-spread-angle θ can be specified via num_rings.
Info
Note that for correct sampling, the number of rays should be atleast 20x the number of rings.
Arguments
The following inputs and arguments can be used to configure the PointSource:
Inputs
pos: center beam starting positiondir: center beam starting directionθ: half spread angle in rad, must be< πλ = 1e-6: wavelength in [m], default val. is 1000 nm
Keyword Arguments
num_rings: number of concentric beam rings, default is 10num_rays: total number of rays in the source, default is 100x num_ringsbasis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle for the source rings.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors are derived from dir deterministically, so two sources sharing the same dir, θ, num_rings and num_rays sample exactly the same ray directions. Pass a basis to rotate the azimuthal sampling of a source about its own axis, e.g. to interleave several otherwise identical sources.
BeamletOptics.PointSource Method
PointSource(beams, NA, pos, dir::AbstractVector)
PointSource(beams, NA, pos, orientation::AbstractMatrix)Wraps existing beams into a PointSource with the numerical aperture NA and the source position pos. The group orientation is either derived from the central direction dir (the sampling reference vector is then picked deterministically via normal3d), or passed explicitly as a right-handed orthonormal 3x3 orientation matrix whose second column is the central direction. An invalid orientation throws an ArgumentError.
BeamletOptics.PolarizationFilter Method
PolarizationFilter(edge_length; cutoff_strength)Spawns a thin, rectangular PolarizationFilter. The edge_length has to be specified in [m]. The filter is aligned with the global y-axis and transmits along the x-axis, while blocking polarization components along the global z-axis.
BeamletOptics.PolarizedRay Type
PolarizedRay{T} <: AbstractRay{T}A ray type to model the propagation of an electric field vector based on the publication:
Yun, Garam, Karlton Crabtree, and Russell A. Chipman. "Three-dimensional polarization ray-tracing calculus I: definition and diattenuation." Applied Optics 50.18 (2011): 2855-2865.
The geometrical ray description is identical to the standard Ray. The polarization interaction can be described in local s-p-coordinates but must be transformed into global coordinates using the method described in the publication above, see also _calculate_global_E0.
Fields
pos: a point in R³ that describes theRayorigindir: a normalized vector in R³ that describes theRaydirectionintersection: refer toIntersectionλ: wavelength in [m]n: refractive index along the beam pathE0: complex-valued 3-tuple to represent the electric field in global coordinates
Jones matrices
In local coordinates the Jones matrices in the case of reflection/refraction are defined as
reflection: [-rₛ 0; 0 rₚ]
transmission: [tₛ 0; 0 tₚ]
where r and t are the complex-valued Fresnel coefficients (see also fresnel_coefficients).
Additional information
Field vector
It is assumed that the electric field vector
Intensity
E0 can not be converted into an intensity value, since a single PolarizedRay can not directly model the change in intensity during imaging by an optical system.
BeamletOptics.PolarizedRay Method
PolarizedRay(pos, dir, λ = 1000e-9, E0 = [1, 0, 0])1 V/m in x-dir.
sourceBeamletOptics.Prism Type
Prism{T, S <: AbstractShape{T}, N <: RefractiveIndex} <: AbstractRefractiveOptic{T, N}Essentially represents the same functionality as Lens. Refer to its documentation.
BeamletOptics.Ray Type
Ray{T} <: AbstractRay{T}Mutable struct to store ray information.
Fields
pos: a point in R³ that describes theRayorigindir: a normalized vector in R³ that describes theRaydirectionintersection: refer toIntersectionλ: wavelength in [m]n: refractive index along the beam path
BeamletOptics.Ray Method
Ray(pos, dir, λ=1000e-9)Constructs a Ray where:
pos: is theRayorigindir: is theRaydirection of propagation, normalized to unit length
Optionally, a wavelength λ can be specified. The start refractive index is assumed to be in vacuum (n = 1).
BeamletOptics.RectangularFlatSurface Type
RectangularFlatSurface{T} <: AbstracCylindricalSurface{T}A type representing a planar rectangular surface, which is only parametrized by its size.
Fields
size::T: The size of the planar surface
BeamletOptics.RectangularPlateBeamsplitter Type
A plate beamsplitter with rectangular substrate and a single coated face. For more information refer to the AbstractPlateBeamsplitter docs.
Fields
substrate: a rectangularPrismthat acts as the substratecoating: aThinBeamsplitterthat acts as the coating
Additional information
Kinematic center
The center of kinematics of this splitter lies at the center of the coating.
BeamletOptics.RectangularPlateBeamsplitter Method
RectangularPlateBeamsplitter(width, height, thickness, n; reflectance=0.5)Creates a RectangularPlateBeamsplitter. The splitter is aligned with the negative y-axis. The splitter coating is centered at the origin. See also RoundPlateBeamsplitter.
Inputs
width: substrate width along the x-axis in [m]height: substrate height along the z-axis in [m]thickness: substrate thickness along the y-axis in [m]n: theRefractiveIndexof the substrate
Keywords
reflectance: defines the splitting ratio in [-], i.e. R = 0 ... 1.0
BeamletOptics.Retroreflector Type
RetroreflectorA Retroreflector reflects incoming rays back toward their source, independent of the incident angle. The shape is represented by a tetrahedral Mesh.
Fields
mesh: shape of theRetroreflector
BeamletOptics.Retroreflector Method
Retroreflector(scale)Spawns a Retroreflector.
Inputs
scale: a scaling factor for the size of the retroreflector, e.g.1e-3for 1 mm
BeamletOptics.RightAnglePrismSDF Type
RightAnglePrismSDF <: AbstractSDFImplements the SDF of a right angle prism with symmetric leg length l and height h. Note that these values are stored in the dimensions field as:
dimensions::Point3 = ( leg_length, # dim in x leg_length, # dim in y height, # dim in z )
Alignment
Note that the prism is not aligned with the positive y-axis!
BeamletOptics.RightAnglePrismSDF Method
RightAnglePrismSDF(leg_length, height)Constructs a symmetric right angle prism with leg_length in x and y and height z in [m].
BeamletOptics.RingSDF Type
RingSDF <: AbstractSDFImplements the SDF of a ring in the x-z-plane for some distance in the y axis. This allows to add planar outer sections to any SDF which fits inside of the ring.
sourceBeamletOptics.RingSDF Method
Constructs a ring with inner_radius with a width and some thickness.
BeamletOptics.RoundPlateBeamsplitter Type
A plate beamsplitter with cylindrical substrate and a single coated face. For more information refer to the AbstractPlateBeamsplitter docs.
Fields
substrate: a cylindricalPrismthat acts as the substratecoating: aRoundThinBeamsplitterthat acts as the coating
Additional information
Kinematic center
The center of kinematics of this splitter lies at the center of the coating.
BeamletOptics.RoundPlateBeamsplitter Method
RoundPlateBeamsplitter(diameter, thickness, n; reflectance=0.5)Creates a RoundPlateBeamsplitter. The splitter is aligned with the negative y-axis. The coating is centered at the origin. See also RectangularPlateBeamsplitter.
Inputs
diameter: x-z-plane substrate diameter in [m]thickness: substrate thickness along the z-axis in [m]n: theRefractiveIndexof the substrate
Keywords
reflectance: defines the splitting ratio in [-], i.e. R = 0 ... 1.0
BeamletOptics.SellmeierEquation Type
SellmeierEquationA parametric type representing the six-coefficient Sellmeier equation for a transparent dielectric material. The Sellmeier equation models the wavelength dependence of the refractive index n(λ) in the material's transparency window. This type can provide n(λ) via a functor call, e.g.:
NBK7 = SellmeierEquation(...)
n_532 = NBK7(532e-9)Info
When initializing this type, the data should be provided with the classic μm-based coefficients. However, when calling the function, use SI-units, e.g. 532e-9 for 532 nm.
Fields
B1,B2,B3: dimensionless Sellmeier coefficients.C1,C2,C3: squared resonance wavelengths in μm².
BeamletOptics.SellmeierEquation Method
Returns the ref. index n(λ) for the six coefficient Sellmeier equation.
BeamletOptics.SingleShape Type
SingleShape <: AbstractShapeTraitRepresents that the AbstractObject consists of a single underlying shape.
AbstractObject implementation reqs.
If shape_trait_of(::Foo) = SingleShape() is defined, Foo must implement the following:
Fields
shape: a single concreteAbstractShape, e.g. aCylinderSDF
BeamletOptics.SphereSDF Type
SphereSDFImplements the SDF of a perfect sphere. Orientation is fixed to unity matrix.
sourceBeamletOptics.SphericalSurface Type
SphericalSurface{T} <: AbstractRotationallySymmetricSurface{T}A type representing a spherical optical surface defined by its radius of curvature, clear (optical) diameter, and mechanical diameter. This surface is rotationally symmetric about its optical axis.
Fields
radius::T: The radius of curvature of the spherical surface. A positive value indicates that the center of curvature lies to the right of the vertex (following ISO 10110).diameter::T: The clear (optical) aperture of the surface.mechanical_diameter::T: The overall mechanical diameter of the surface. In many cases, this is equal to the optical diameter, but it can be set independently if the mechanical mount requires a larger dimension.
BeamletOptics.SphericalSurface Method
SphericalSurface(radius, diameter)Construct a SphericalSurface given the radius of curvature and the optical diameter. This constructor automatically sets the mechanical diameter equal to the optical diameter.
Arguments
radius: The radius of curvature of the surface.diameter: The clear (optical) diameter of the surface.
BeamletOptics.Static Type
Static <: AbstractKinematicTraitRepresents a value that cannot be moved. Every kinematic function throws an ArgumentError; the getters (e.g. position, orientation) stay available. This is the fallback of kinematic_trait_of.
BeamletOptics.StaticSystem Type
StaticSystem <: AbstractSystemA static container storing the optical elements of, i.e. a camera lens or lab setup. Compared to System this way defining the system is less flexible, i.e. no elements can be added or removed after construction but it allows for more performant ray-tracing.
Warning
This type uses long tuples for storing the elements. This container should not be used for very large optical systems as it puts a lot of stress onto the compiler.
Fields
objects: vector containing the different objects that are part of the system (subtypes ofAbstractObject)
BeamletOptics.System Type
System <: AbstractSystemA container storing the optical elements of, i.e. a camera lens or lab setup.
Fields
objects: vector containing the different objects that are part of the system (subtypes ofAbstractObject)
BeamletOptics.ThinBeamsplitter Type
ThinBeamsplitter <: AbstractBeamsplitterRepresents a 2D beam-splitting device.
Fields
shape: 2DAbstractShapeat which the splitting process occurs (e.g. a 2D-Mesh)reflectance: scalar reflection factortransmittance: scalar transmission factor
Warning
Note that the transmittance should be calculated from an input reflectance in order to ensure that R² + T² = 1.
BeamletOptics.ThinBeamsplitter Method
ThinBeamsplitter(width, height; reflectance=0.5)Creates a zero-thickness, lossless, non-polarizing 2D rectangular ThinBeamsplitter where
width: is the x-dir. edge length in [m]height: is the z-dir. edge length in [m]reflectance: kw-arg that determines how much light is reflected, i.e. 0.7 for a 70:30 splitter
Additional information
Reflectance
The input value for the reflectance R is normed such that R² + T² = 1, where T is the transmittance. The transmittance is calculated via T = √(1 - R²).
Reflection phase jump
Note that the reflection phase jump θᵣ is implemented by the individual interact3d-methods. Refer to them for more information.
BeamletOptics.TripletLens Type
TripletLensRepresents a three-component cemented triplet lens with three respective refractive indices n = n(λ). See also SphericalTripletLens.
Fields
Additional information
Clear apertures
If the surfaces need different clear apertures (e.g. a steep last surface), build the elements via Lens(SphericalSurface(r1, d1), SphericalSurface(r2, d2), l, n) and pass them to TripletLens. SphericalTripletLens uses one diameter for all surfaces.
Air gap
This component type strongly assumes that all three lenses are mounted fully flush with respect to each other. Gaps between the components might lead to incorrect results.
Total internal reflection
Total internal reflection at a cemented interface between two elements is not modeled correctly.
BeamletOptics.UnionSDF Type
UnionSDF{T, TT <: Tuple} <: AbstractSDF{T}This SDF represents the merging of two or more SDFs. If the constituent SDFs do not overlap (they can and should touch) the resulting SDF should be still exact if the constituent SDFs are exact.
The intended way to construct these is not explicitely but by just adding two AbstractSDFs using the regular + operator.
s1 = SphereSDF(1.0)
translate3d!(s1, Point3(0, 1.0, 0.0))
s2 = SphereSDF(1.0)
# will result in a SDF with two spheres touching each other.
s_merged = s1 + s2BeamletOptics._LazyProgress Type
_LazyProgressThread-safe progress counter for long loops. It draws a ProgressMeter.Progress bar only once the loop has run for threshold seconds, see get_progress_threshold.
_tick! costs one atomic increment and one time() call per item. The bar is created lazily and redrawn at most every dt seconds by one thread at a time (trylock), so an invisible bar never contends for a lock. Use it through _with_progress, which finishes the bar, or cancels it if the loop throws.
Fields
n: total number of itemsdesc: description printed in front of the barenabled: iffalse,_tick!returns after a single branchoutput: stream the bar is drawn tocount: number of finished itemstnext: earliesttime()at which the bar is created or redrawn,Infstops drawingdt: minimum interval in s between redrawslock: serializes creating, redrawing and stopping the barbar: the ProgressMeter bar,nothinguntil it is first drawn
BeamletOptics._LazyProgress Method
_LazyProgress(progress::Bool, n, desc)Progress counter for the progress keyword of a public function. It is enabled only if progress is true and stderr is a terminal (Base.TTY), so documentation builds, CI logs and piped output stay clean.
BeamletOptics._LazyProgress Method
_LazyProgress(n, desc; enabled = true, output = stderr, threshold = get_progress_threshold(), dt = 0.2)Progress counter for n items that draws to output once threshold seconds have passed.
Base.empty! Method
empty!(agb::AstigmaticGaussianBeamlet)Resets the beamlet to its untraced start state, i.e. resets all 9 component beams and drops all child beamlets.
sourceBase.empty! Method
Resets the beam to its untraced start state: all rays but the first are removed, the intersection of the start ray is cleared and all child beams are dropped.
Base.empty! Method
empty!(detector)Resets the field data of the detector. Must be implemented for each concrete subtype of AbstractDetector.
Base.empty! Method
empty!(gauss::GaussianBeamlet)Resets the beamlet to its untraced start state, i.e. resets the chief, waist and divergence beams and drops all child beamlets.
Base.length Method
Base.length(ray::AbstractRay)Returns the geometric length of a ray between its start and intersection point. If no intersection exists, Inf is returned.
Tip
Use optical_path_length to get the optical path length instead.
Base.length Method
Base.length(beam::Beam)Calculate the length of a beam up to the point of the last intersection.
Tip
Use optical_path_length to get the optical path length instead.
Base.position Method
position(object) -> Point3Returns the current position of the object in R³ as a Point3 where (x, y, z) in a right-hand coordinate system.
In general, position(object) returns position(shape(object)) unless specified otherwise.
BeamletOptics.BiConcaveLensSDF Method
BiConcaveLensSDF(r1, r2, l, d=1inch)Constructs a bi-concave lens SDF with:
r1> 0: radius of concave frontr2> 0: radius of convex backl: lens thicknessd: lens diameter, default value is one inchmd: mechanical lens diameter, adds an outer ring section to the lens, ifmd>d.
The spherical surfaces are constructed flush with the cylinder surface.
sourceBeamletOptics.BiConvexLensSDF Method
BiConvexLensSDF(r1, r2, l, d=1inch)Constructs a cylindrical bi-convex lens SDF with:
r1> 0: radius of convex frontr2> 0: radius of convex backl: lens thicknessd: lens diameter, default value is one inch
The spherical surfaces are constructed flush with the cylinder surface.
sourceBeamletOptics.CircularFlatMesh Method
CircularFlatMesh(radius, n)Creates a 2D rectangular Mesh that is centered around the origin and aligned with respect to the negative y-axis.
Inputs
radius: of the mesh in [m]n: slice discretization factor (higher equals better resolution)
BeamletOptics.CollimatedGaussianBeamletSource Method
CollimatedGaussianBeamletSource(pos, dir, D, λ, w0s; n_grid=20)Generates an n_grid × n_grid square array of AstigmaticGaussianBeamlets, all pointing in the same direction and having the same uniform amplitude. This is used to model macroscopic plane waves or flat-top beams passing through hard apertures (e.g., for Fraunhofer or Fresnel diffraction).
Arguments
pos: Center position of the source plane.dir: Propagation direction.D: Total width/height of the square aperture.λ: Wavelength.w0s: Sub-waist of each individual beamlet. For smooth overlap,w0s ≈ D / n_grid.n_grid: Number of beamlets along one axis (default20yields400total beamlets).basis: Optional tuple(ex, ey)of the macroscopic sampling grid axes, i.e. the 3D directions corresponding to thexandygrid axes.exmust not be zero or parallel todir; its component normal todirbecomes the local x-axis of the grouporientation.randomize_axes: Iftrue, the internal principal axes of each individual beamlet are randomly rotated. This averages out numerical grid-alignment biases and is essential for preserving rotational symmetry in focused spots (e.g. Airy disks).rng: Random number generator to use forrandomize_axes.
BeamletOptics.ConicMirror Method
ConicMirror(R, k, diameter; thickness=nothing, hole_diameter=nothing)Constructs an on-axis segment of a general conic-of-revolution Mirror (sphere, paraboloid, ellipsoid or hyperboloid). The vertex lies at the origin and the mirror opens towards the negative y-axis for R > 0. See OffAxisConicMirror for the off-axis case and the full sign/domain conventions.
If hole_diameter is given, a cylindrical bore centred on the optical axis (the local +y-axis) is subtracted from the substrate, piercing it completely (e.g. Cassegrain, Ritchey-Chrétien, or Dall-Kirkham primary).
Inputs
R: Radius of curvature at the vertex [m];R > 0concave,R < 0convexk: Conic constant;k = -1is a paraboloid (seeParabolicMirror),k = 0a sphere (seeSphericalMirror)diameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter.
BeamletOptics.CuboidMesh Method
CuboidMesh(x, y, z, θ=π/2)Constructs the Mesh of a rectangular cuboid as per the dimensions specified by x, y and z. In addition, one side of the mesh can be tilted by an angle θ in order to generate the mesh of a rhomb. The mesh is initialized such that one corner of the cuboid lies at the origin.
Arguments
x, y, z: dimensions for the cube in [m]θ: parallel tilt angle
BeamletOptics.EllipsoidalMirror Method
EllipsoidalMirror(s, s′, diameter; thickness=nothing, hole_diameter=nothing)Constructs an on-axis segment of an ellipsoidal Mirror whose two real conjugate foci lie at (0, -s, 0) and (0, -s′, 0); the vertex lies at the origin. See OffAxisEllipsoidalMirror for the off-axis case and the sign convention for s, s′.
If hole_diameter is given, a cylindrical bore centred on the optical axis (the local +y-axis) is subtracted from the substrate, piercing it completely (e.g. Dall-Kirkham primary).
Inputs
s,s′: Conjugate object/image distances from the vertex [m], same signdiameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter.
BeamletOptics.EllipticalGaussianBeamletSource Method
EllipticalGaussianBeamletSource(pos, dir, θ_x, θ_y, λ; num_rings=10, num_rays=100*num_rings, ...)Spawns a coherent array of AstigmaticGaussianBeamlets distributed on an elliptical cap. This is ideal for modelling sources with different divergences in the fast and slow axes, such as tapered amplifiers or edge-emitting laser diodes.
Arguments
pos: Origin point of the spherical wave.dir: Central propagation direction.θ_x,θ_y: Half spread angles in radians for the two principal axes.λ: Wavelength.num_rings: Number of concentric angular rings.num_rays: Total number of beamlets to generate.overlap: Scaling factor for the sub-waist divergence (default1.2ensures smooth overlap).basis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle for the source rings.randomize_axes: Iftrue, the internal principal axes of each individual beamlet are randomly rotated.rng: Random number generator to use forrandomize_axes.P0: Total power of the source in [W].E0: Optional Jones vector defining the polarization and phase of the wave.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors are derived from dir deterministically, so two sources sharing the same arguments sample exactly the same beamlet directions. Pass a basis to rotate the azimuthal sampling of a source about its own axis. A basis that is zero or parallel to dir throws.
BeamletOptics.GaussianBeamletDecomposition Method
GaussianBeamletDecomposition(pos, dir, λ, w0; n_grid=20)Decomposes a macroscopic Gaussian beam of waist w0 into an n_grid × n_grid array of microscopic AstigmaticGaussianBeamlets. This allows the accurate tracing of large Gaussian beams through highly aberrative or non-paraxial optical systems, perfectly preserving higher-order phase aberrations via the coherent superposition of the sub-beamlets.
Arguments
pos: Waist center position of the macroscopic beam.dir: Propagation direction.λ: Wavelength.w0: Macroscopic beam waist.n_grid: Number of beamlets along one axis (default20yields400total beamlets).overlap: Scaling factor for the sub-waist relative to grid spacing (default1.2ensures smooth overlap).basis: Optional tuple(ex, ey)of the macroscopic sampling grid axes, i.e. the 3D directions corresponding to thexandygrid axes.exmust not be zero or parallel todir; its component normal todirbecomes the local x-axis of the grouporientation.randomize_axes: Iftrue, the internal principal axes of each individual beamlet are randomly rotated. This averages out numerical grid-alignment biases and is essential for preserving rotational symmetry in focused spots.rng: Random number generator to use forrandomize_axes.P0: Total power of the macroscopic Gaussian beam in [W].E0: Optional Jones vector defining the polarization and initial phase of the beam. Ifnothing, defaults to linear polarization along the first grid axis.threshold: Relative amplitude below which beamlets are not spawned (default1e-4).
BeamletOptics.HyperbolicMirror Method
HyperbolicMirror(s, s′, diameter; thickness=nothing, hole_diameter=nothing)Constructs an on-axis segment of a hyperboloidal Mirror (e.g. a Cassegrain/Gregory secondary, or a Ritchey-Chrétien primary) whose conjugate foci lie at (0, -s, 0) and (0, -s′, 0); the vertex lies at the origin. See OffAxisHyperbolicMirror for the off-axis case and the sign convention.
If hole_diameter is given, a cylindrical bore centred on the optical axis (the local +y-axis) is subtracted from the substrate, piercing it completely (e.g. Ritchey-Chrétien primary).
Cassegrain secondary
The secondary of a Cassegrain/Gregory telescope sees the prime focus behind itself, so pass it as a negative s.
Inputs
s,s′: Conjugate object/image distances from the vertex [m], opposite signsdiameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter.
BeamletOptics.KM100CPMount Method
KM100CPMount()Returns a MeshDummy of a Thorlabs KM100CP/M kinematic mount for Ø1" optics on a post. The origin lies at the center of a mounted Ø1" mirror, i.e. a RoundPlanoMirror spawned at the origin sits in the mount, and the post base is 81.8 mm below it.
The mesh is loaded from the documentation assets that ship with the package. Combine it with a mirror via ObjectGroup to move both together.
BeamletOptics.MeshDummy Method
MeshDummy(loadpath::String)Creates a NonInteractableObject with a Mesh loaded from the specified file path. Useful for rendering background objects or geometry that does not interact with rays.
BeamletOptics.MoellerTrumboreAlgorithm Method
MoellerTrumboreAlgorithm(face::Matrix, ray::Ray)A culling implementation of the Möller-Trumbore algorithm for ray-triangle-intersection. This algorithm evaluates the possible intersection between a ray and a face that is defined by three vertices. If no intersection occurs, Inf is returned. kϵ is the abort threshold for backfacing and non-intersecting triangles. lϵ is the threshold for negative values of t. This algorithm is fast due to multiple breakout conditions.
BeamletOptics.OffAxisConicMirror Method
OffAxisConicMirror(R, k, x_off, diameter; thickness=nothing, hole_diameter=nothing)Constructs an off-axis segment of a general conic-of-revolution Mirror (sphere, paraboloid, ellipsoid or hyperboloid), offset by x_off from the parent vertex. See ConicSDF for the frame convention (origin, parent axis, opening direction, vertex location).
Inputs
R: Radius of curvature at the parent vertex [m];R > 0is concave (opens towards-y),R < 0is convex (opens towards+y). Must be non-zero.k: Conic constant.k = -1is a paraboloid,k = 0a sphere,-1 < k <= 0a prolate ellipsoid,k > 0an oblate ellipsoid,k < -1a hyperboloid.x_off: Off-axis distance from the parent vertex to the aperture center [m]diameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter. The bore is parallel to the local +y axis through the aperture centre.
For k > -1 the aperture must stay within the domain of the parent conic (abs(x_off) + diameter/2 < abs(R)/sqrt(1+k)), otherwise an ArgumentError is thrown; for k <= -1 there is no such limit. See also ConicMirror for the on-axis case.
Note that hole_axis (collimated/focused bore) exists only for OffAxisParabolicMirror.
BeamletOptics.OffAxisEllipsoidalMirror Method
OffAxisEllipsoidalMirror(s, s′, x_off, diameter; thickness=nothing, hole_diameter=nothing)Constructs an off-axis segment of an ellipsoidal Mirror whose two real conjugate foci lie at object/image distances s, s′ from the parent vertex, offset by x_off. Both foci lie on the same side (the -y, i.e. reflecting, side) of the parent vertex for positive s, s′.
Inputs
s,s′: Conjugate object/image distances from the parent vertex [m], measured positive towards-y(in front of the mirror). Must have the same sign.x_off: Off-axis distance from the parent vertex to the aperture center [m]diameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter. The bore is parallel to the local +y axis through the aperture centre.
The vertex radius of curvature and conic constant are derived via R = 2ss′/(s+s′), k = -((s′-s)/(s′+s))^2. See also EllipsoidalMirror for the on-axis case.
Note that hole_axis (collimated/focused bore) exists only for OffAxisParabolicMirror.
BeamletOptics.OffAxisHyperbolicMirror Method
OffAxisHyperbolicMirror(s, s′, x_off, diameter; thickness=nothing, hole_diameter=nothing)Constructs an off-axis segment of a hyperboloidal Mirror whose conjugate foci lie at object/image distances s, s′ from the parent vertex, offset by x_off. Exactly one focus is virtual, i.e. s and s′ have opposite signs.
Inputs
s,s′: Conjugate object/image distances from the parent vertex [m], measured positive towards-y(real focus, in front of the mirror) and negative towards+y(virtual focus, behind the mirror). Must have opposite signs.x_off: Off-axis distance from the parent vertex to the aperture center [m]diameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter. The bore is parallel to the local +y axis through the aperture centre.
Cassegrain secondary
The secondary of a Cassegrain/Gregory telescope sees the prime focus behind itself, so pass it as a negative s.
The vertex radius of curvature and conic constant are derived via R = 2ss′/(s+s′), k = -((s′-s)/(s′+s))^2. See also HyperbolicMirror for the on-axis case.
Note that hole_axis (collimated/focused bore) exists only for OffAxisParabolicMirror.
BeamletOptics.OffAxisParabolicMirror Method
OffAxisParabolicMirror(rfl, diameter; angle=90, thickness=nothing, hole_diameter=nothing, hole_axis=:collimated)Constructs an Off-Axis Parabolic (OAP) Mirror from:
Inputs
rfl: Reflected Focal Length (distance from aperture center to focus) [m]diameter: Mirror aperture diameter [m]angle: Deflection angle in degrees (default: 90°)thickness: Substrate thickness [m], calculated automatically to ensure solid backing ifnothing(default)hole_diameter: Diameter of the through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter.hole_axis: Orientation of the through-hole. Options: -:collimated(default): parallel to the collimated beam (local y-axis / substrate normal), centered at the aperture center(0, 0, 0). -:focused: angled towards the parent paraboloid focus(-x_off, x_off^2/(4f) - f, 0)in the segment frame, equivalently(-rfl*sind(angle), -rfl*cosd(angle), 0)withanglein degrees, passing through the aperture center(0, 0, 0)(e.g. for collinear pump-probe beams).
BeamletOptics.OffAxisParaboloidSDF Method
OffAxisParaboloidSDF(f, x_off, diameter, thickness)Constructs a ConicSDF with R = 2f and k = -1, i.e. a segment of a paraboloid of revolution. Kept for backwards compatibility; prefer ConicSDF.
BeamletOptics.ParabolicMirror Method
ParabolicMirror(f, diameter; thickness=nothing, hole_diameter=nothing)Constructs an on-axis parabolic Mirror with focal length f. The vertex of the concave reflecting surface lies at the origin, the mirror opens towards the negative y-axis and its focus lies at (0, -f, 0). The shape is an OffAxisParaboloidSDF without off-axis offset.
If hole_diameter is given, a cylindrical bore centred on the optical axis (the local +y-axis) is subtracted from the substrate, piercing it completely (a Cassegrain primary).
Reflective bore wall
Rays that graze into the hole will reflect off its wall rather than being absorbed.
Inputs
f: Focal length [m]diameter: Mirror aperture diameter [m]thickness: Substrate thickness [m], rim sag + 10 mm ifnothing(default)hole_diameter: Diameter of the central through-hole [m], no hole ifnothing(default). Must satisfy0 < hole_diameter < diameter.
BeamletOptics.PlanoConcaveAsphericalLensSDF Method
PlanoConcaveAsphericalLensSDF(r, l, d=1inch)Constructs a plano-concave aspheric lens SDF with:
r> 0: front radiusl: lens thicknessd: lens diametercz: aspheric surface chip zonek: The conic constant of the surfaceα_coeffs: The (even) aspheric coefficients, starting with A4.md: lens mechanical diameter (default: md = d)
The spherical surface is constructed flush with the cylinder surface.
sourceBeamletOptics.PlanoConcaveLensSDF Method
PlanoConcaveLensSDF(r, l, d=1inch)Constructs a plano-concave lens SDF with:
r> 0: front radiusl: lens thicknessd: lens diameter, default value is one inchmd: mechanical lens diameter, must be > d
The spherical surface is constructed flush with the cylinder surface.
sourceBeamletOptics.PlanoConvexAsphericalLensSDF Method
PlanoConvexAsphericalLensSDF(r, l, d=1inch)Constructs a plano-convex aspheric lens SDF with:
r> 0: front radiusl: lens thicknessd: lens diameterk: The conic constant of the surfaceα_coeffs: The (even) aspheric coefficients, starting with A4.
The spherical surface is constructed flush with the cylinder surface.
sourceBeamletOptics.PlanoConvexLensSDF Method
PlanoConvexLensSDF(r, l, d=1inch)Constructs a plano-convex lens SDF with:
r> 0: front radiusl: lens thicknessd: lens diameter, default value is one inch
The spherical surface is constructed flush with the cylinder surface.
sourceBeamletOptics.QuadraticFlatMesh Method
QuadraticFlatMesh(width)Creates a 2D quadratic Mesh. Refer to RectangularFlatMesh for more information.
BeamletOptics.RectangularCompensatorPlate Method
RectangularCompensatorPlate(width, height, thickness, n)Creates a compensator plate (modeled as a Prism) that can be used to remove parallel beam offsets created by e.g. the RectangularPlateBeamsplitter. The compensator is aligned with the positive y-axis. The first surface lies at the origin.
Inputs
width: compensator width along the x-axis in [m]height: compensator height along the z-axis in [m]thickness: compensator thickness along the y-axis in [m]n: theRefractiveIndexof the substrate
BeamletOptics.RectangularFlatMesh Method
RectangularFlatMesh(width, height)Creates a 2D rectangular Mesh that is centered around the origin and aligned with respect to the y-axis. Vertex normals are parallel to the positive y-axis.
Inputs
width: width along the x-axis in [m]height: height along the z-axis in [m]
BeamletOptics.RectangularPlanoMirror Method
RectangularPlanoMirror(width, height, thickness)Constructs a rectangular plano Mirror based on the input dimensions. The front reflecting surface is normal to the y-axis and lies at the origin.
Inputs
width: of the mirror in x-direction [m]height: of the mirror in z-direction [m]thickness: of the mirror in y-direction [m]
BeamletOptics.RetroMesh Method
RetroMesh(scale::Real; T = Float64)Creates an open tetrahedral Mesh with edges derived from the vertices of a unit cube. Can be scaled with a scale factor. The data type for the vertices and internal computations can be adjusted using T (default: Float64).
BeamletOptics.RightAnglePrism Method
RightAnglePrism(leg_length, height, n)Creates a right angle symmetric Prism. The prism is not aligned with the y-axis.
Inputs
leg_length: dimension in x- and y-direction in [m]height: in [m]n:RefractiveIndexof the prism
BeamletOptics.RightAnglePrismMirror Method
RightAnglePrismMirror(leg_length, height)Constructs a right-angle prism Mirror with perfect reflectivity (R = 1). The reflecting surface is modeled using a BeamletOptics.RightAnglePrismSDF.
Inputs
leg_length: edge length in x and y [m]height: height in z-axis [m]
BeamletOptics.RoundLinearPolarizer Method
RoundLinearPolarizer(diameter, front_thickness, back_thickness, n; cutoff_strength=eps())Creates a LinearPolarizer: a round polarizing film cemented between two round glass plates of the given diameter, flush against the film on both sides.
Inputs
diameter: outer diameter of the film and substrates in [m]front_thickness: thickness of the front glass substrate in [m]back_thickness: thickness of the back glass substrate in [m]n:RefractiveIndexof both glass substrates
Keywords
cutoff_strength: passed toRoundPolarizationFilter
Additional information
The component is centered on the film (local origin); the front substrate extends from y = -front_thickness to y = 0, the back substrate from y = 0 to y = back_thickness, along local +y. The film transmits along local x and blocks local z.
BeamletOptics.RoundPlanoMirror Method
RoundPlanoMirror(diameter, thickness; hole_diameter=nothing)Constructs a round plano Mirror with a flat reflecting surface and perfect reflectivity (R = 1). The reflecting surface is modeled using a BeamletOptics.PlanoSurfaceSDF.
Inputs
diameter: mirror diameter [m]thickness: mirror substrate thickness [m]hole_diameter: diameter of the central through-hole [m], no hole ifnothing(default)
BeamletOptics.RoundPolarizationFilter Method
RoundPolarizationFilter(diameter; cutoff_strength)Spawns a thin, round PolarizationFilter with the given diameter in [m]. The filter is centered at the origin, aligned with the global y-axis and transmits along the x-axis, while blocking polarization components along the global z-axis.
BeamletOptics.RoundThinBeamsplitter Method
RoundThinBeamsplitter(diameter; reflectance=0.5)Creates a zero-thickness, 2D round ThinBeamsplitter with the specified diameter in [m]. For more information, refer to the ThinBeamsplitter constructor.
BeamletOptics.SphericalDoubletLens Method
SphericalDoubletLens(r1, r2, r3, l1, l2, d, n1, n2)Generates a two-component "cemented" doublet lens consisting of two spherical lenses. For radii sign definition, refer to the SphericalLens constructor.
Arguments
r1: radius of curvature for first surfacer2: radius of curvature for second (cemented) surfacer3: radius of curvature for third surfacel1: first lens thicknessl2: second lens thicknessd: lens diametern1: first lensRefractiveIndexn1: second lensRefractiveIndex
BeamletOptics.SphericalGaussianBeamletSource Method
SphericalGaussianBeamletSource(pos, dir, θ, λ; num_rings=10, num_rays=100*num_rings)Decomposes a macroscopic spherical wave (or a highly divergent/focused beam) into a cone of AstigmaticGaussianBeamlets originating from a single point pos.
The angular spread of the beamlets is bounded by the half-angle θ. To ensure a smooth far-field interference pattern without speckle, the sub-waist w0s of each beamlet is automatically calculated such that their far-field divergence perfectly overlaps with adjacent beamlets in the grid.
Arguments
pos: Origin point of the spherical wave.dir: Central propagation direction.θ: Half spread angle in radians.λ: Wavelength.num_rings: Number of concentric angular rings.num_rays: Total number of beamlets to generate.overlap: Scaling factor for the sub-waist divergence (default1.2ensures smooth overlap).basis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle for the source rings.randomize_axes: Iftrue, the internal principal axes of each individual beamlet are randomly rotated. This averages out numerical artifacts in the far-field focus.rng: Random number generator to use forrandomize_axes.P0: Total power of the spherical source in [W].E0: Optional Jones vector defining the polarization and phase of the spherical wave.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors are derived from dir deterministically, so two sources sharing the same arguments sample exactly the same beamlet directions. Pass a basis to rotate the azimuthal sampling of a source about its own axis. A basis that is zero or parallel to dir throws.
BeamletOptics.SphericalLens Function
SphericalLens(r1, r2, l, d=1inch, n=λ->1.5)Creates a spherical Lens based on:
r1: front radiusr2: back radiusl: lens thicknessd: lens diameter, default is one inchn:RefractiveIndexas a function of λ, i.e.n = n(λ)
Notes
Radius of curvature (ROC) sign
The ROC is defined to be positive if the center is to the right of the surface. Otherwise it is negative.
Thin lenses
If l is set to zero, a ThinLens will be created. However, note that the actual lens thickness will be different from zero.
BeamletOptics.SphericalMirror Method
SphericalMirror(radius, thickness, diameter; hole_diameter=nothing)Constructs a concave spherical Mirror with perfect reflectivity (R = 1). The reflecting surface is modeled as a BeamletOptics.UnionSDF of a concave spherical surface and a plano substrate, combining BeamletOptics.ConcaveSphericalSurfaceSDF and BeamletOptics.PlanoSurfaceSDF.
Inputs
radius: spherical surface radius of curvature [m]thickness: substrate thickness [m]diameter: mirror outer diameter [m]hole_diameter: diameter of the central through-hole [m], no hole ifnothing(default)
BeamletOptics.SphericalTripletLens Method
SphericalTripletLens(r1, r2, r3, r4, l1, l2, l3, d, n1, n2, n3)Generates a three-component "cemented" triplet lens consisting of three spherical lenses. The middle and back lens are translated along +y so that they sit flush. For radii sign definition, refer to the SphericalLens constructor.
Arguments
r1: radius of curvature for first surfacer2: radius of curvature for second (first cemented) surfacer3: radius of curvature for third (second cemented) surfacer4: radius of curvature for fourth surfacel1: first lens thicknessl2: second lens thicknessl3: third lens thicknessd: lens diametern1: first lensRefractiveIndexn2: second lensRefractiveIndexn3: third lensRefractiveIndex
Additional information
Inf gives a plano surface.
BeamletOptics.SquarePlanoMirror Method
SquarePlanoMirror(width, thickness)Constructs a square plano Mirror with equal width and height. The front reflecting surface is normal to the y-axis and lies at the origin. See also RectangularPlanoMirror.
Inputs
width: the side length of the square mirror in x- and y-direction [m]thickness: of the mirror in [m]
BeamletOptics.SquarePlanoMirror2D Method
SquarePlanoMirror2D(edge_length)Constructs a 2D square plano Mirror with a given edge_length. The reflecting surface is normal to the y-axis.
Inputs
edge_length: the edge length of the square mirror in [m]
BeamletOptics.ThinLens Method
ThinLens(R1::Real, R2::Real, d::Real, n::Function)Directly creates an ideal spherical thin Lens with radii of curvature R1 and R2 and diameter d and RefractiveIndex n.
BeamletOptics.ThinLensSDF Method
ThinLensSDF(r1, r2, d=1inch)Constructs a bi-convex thin lens SDF-based shape with:
r1 > 0: radius of convex frontr2 > 0: radius of convex backd: lens diameter, default value is one inch
The spherical surfaces are constructed flush.
sourceBeamletOptics.UniformDiscSource Method
UniformDiscSource(pos, dir, diameter, λ; num_rays=1_000, basis)Generates a ray fan with equal area per ray across a circular pupil using the deterministic sunflower (Fibonacci) pattern.
The radius of the k-th ray (k = 0 … N-1) is ρₖ = diameter/2 ⋅ √((k + ½)/N), its azimuth is k times the golden angle π(3 - √5).
Note
This is merely a CollimatedSource constructor which uses Fibonacci sampling instead of concentric rings. Unlike CollimatedSource, there is no dedicated center beam at pos, i.e. all rays are equally weighted samples of the pupil.
Arguments
The following inputs and arguments can be used to configure the underlying CollimatedSource:
Inputs
pos: center of the pupil disc, i.e. the source positiondir: starting direction of all beamsdiameter: outer beam bundle diameter in [m]λ = 1e-6: wavelength in [m]
Keyword Arguments
num_rays=1000: total number of rays in the sourcebasis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle of the sunflower pattern.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors spanning the pupil plane are derived from dir deterministically, so two sources sharing the same dir, diameter and num_rays sample exactly the same ray positions. Pass a basis to rotate the sunflower pattern about its own axis, e.g. to interleave several otherwise identical sources.
BeamletOptics.UniformPointSource Method
UniformPointSource(pos, dir, θ, λ; num_rays=1_000, basis)Generates a cone of Beams emitted from pos with equal solid angle per ray across the spherical cap 0 ≤ ϑ ≤ θ around dir, using the deterministic sunflower (Fibonacci) pattern. The polar angle ϑₖ of the k-th ray (k = 0 … N-1) follows from cos ϑₖ = 1 - (k + ½)/N ⋅ (1 - cos θ), its azimuth is k times the golden angle π(3 - √5).
Note
This is merely a PointSource constructor which uses Fibonacci sampling instead of concentric rings. Unlike PointSource, there is no dedicated center beam along dir, i.e. all rays are equally weighted samples of the cap.
Arguments
The following inputs and arguments can be used to configure the underlying PointSource:
Inputs
pos: starting position of all beamsdir: central source direction, i.e. the cone axisθ: half spread angle in rad, must be< πλ = 1e-6: wavelength in [m], default val. is 1000 nm
Keyword Arguments
num_rays=1000: total number of rays in the source, must be≥ 1basis: Optional reference vector (e.g.[1,0,0]) to define the starting azimuthal angle of the sunflower pattern. Must not be zero or parallel todir.
Reproducible sampling
If no basis is passed, the orthogonal basis vectors are derived from dir deterministically, so two sources sharing the same dir, θ and num_rays sample exactly the same ray directions. Pass a basis to rotate the sunflower pattern about its own axis, e.g. to interleave several otherwise identical sources.
BeamletOptics.WavefrontBeamletDecomposition Method
WavefrontBeamletDecomposition(x, y, amplitude, phase, dir, λ; threshold=1e-4)Decomposes an arbitrary complex scalar field (defined by a spatial amplitude and phase distribution on a 2D grid x and y) into a collection of AstigmaticGaussianBeamlets.
This function uses the Eikonal approximation to map the local phase gradient into a local propagation direction for each beamlet. It allows users to import arbitrary, aberrated, or custom beam profiles (e.g. from a camera or a wavefront sensor) and propagate them through a BeamletOptics system.
The grid is placed in the plane normal to dir through the global origin, i.e. the group center is (0, 0, 0). Use translate3d! to move the decomposed field to its actual position.
Arguments
x,y: Vectors defining the 1D spatial coordinates of the 2D field grid.amplitude: 2D array of field amplitudes(length(x) × length(y)).phase: 2D array of phase values in radians.dir: The macroscopic reference propagation direction (e.g.,[0, 1, 0]).λ: Wavelength.threshold: Relative amplitude threshold below which beamlets are not spawned (saves computation).overlap: Scaling factor for the sub-waist relative to grid spacing (default1.2ensures smooth overlap).basis: Optional tuple(ex, ey)of the macroscopic sampling grid axes, i.e. the 3D directions corresponding to thexandyinput axes.exmust not be zero or parallel todir; its component normal todirbecomes the local x-axis of the grouporientation.randomize_axes: Iftrue, the internal principal axes of each individual beamlet are randomly rotated. This averages out numerical grid-alignment biases and helps preserve rotational symmetry in focused patterns.rng: Random number generator to use forrandomize_axes.E0: Optional reference polarization vector or Jones vector. Ifnothing, defaults to linear polarization along the first grid axis.
BeamletOptics._beams_hits_same_shape Method
_beams_hits_same_shape(agb, id)Tests if all 9 component rays at section id hit the same object shape.
BeamletOptics._beams_hits_same_shape Method
_beams_hits_same_shape(gauss, id)Tests if all rays at section id of gauss hit the same object shape. Returns true or false.
BeamletOptics._calculate_global_E0 Method
_calculate_global_E0(in_dir, out_dir, normal, J)Calculates the resulting polarization matrix as per the publication by Yun et al. for each surface interaction. If the normal- vector and the in- and out-directions of propagation are in parallel, an arbitrary basis is chosen for the s- and p-components.
Arguments
in_dir: propagation direction before surface interactionout_dir: propagation direction after surface interactionnormal: surface normal at the point of intersectionJ: Jones matrix extended to 3x3, e.g. [-rₛ 0 0; 0 rₚ 0; 0 0 1] for reflection
BeamletOptics._check_kinematic_members Method
_check_kinematic_members(members)Throws an ArgumentError if some members of a container are Static and some are Movable. Empty collections pass.
BeamletOptics._check_orientation Method
_check_orientation(M, T) -> SMatrix{3,3,T,9}Validates that M is a right-handed orthonormal 3x3 matrix, i.e. MᵀM ≈ I and det M ≈ 1 within √eps(T), and converts it into an SMatrix{3,3,T,9}. Throws an ArgumentError otherwise.
BeamletOptics._component_beams Method
Return a tuple of all 9 component beams of the AstigmaticGaussianBeamlet.
BeamletOptics._component_beams Method
_component_beams(beam::AbstractBeam)Returns a tuple of the component Beams of a composite beam (e.g. a GaussianBeamlet), chief beam first. Required for the kinematic API of composite beams.
BeamletOptics._component_beams Method
Return a tuple of the chief, waist and divergence beams of the GaussianBeamlet.
BeamletOptics._container_trait Method
_container_trait(members)Returns the kinematic trait of a container with homogeneous members (see _check_kinematic_members): Static() if the members are static, else Movable(Oriented()).
BeamletOptics._film_interface Method
_film_interface(system, lp::LinearPolarizer, from, to, beam, ray::PolarizedRay)Handles the cemented from → to glass interface for a PolarizedRay. The polarizing film acts on the incident field (still expressed in from) before the ray crosses into to. In case of total internal reflection at the cemented interface, the ray is reflected back into from and the film is not applied.
BeamletOptics._film_interface Method
_film_interface(system, lp::LinearPolarizer, from, to, beam, ray::Ray)Handles the cemented from → to glass interface for an unpolarized Ray: the film has no effect, only glass-to-glass refraction (with total internal reflection handling) occurs.
BeamletOptics._group_orientation Method
_group_orientation(dir, e1, T) -> SMatrix{3,3,T,9}Returns the orientation matrix of a beam group with the columns (e1, dir, e1 × dir), i.e. local x = sampling reference vector e1, local y = optical axis dir. Both inputs are normalized, e1 must be normal to dir.
BeamletOptics._is_film_interface Method
_is_film_interface(lp::LinearPolarizer, from, ray::AbstractRay)::BoolTests whether ray, having just crossed a prism (from is lp.front or lp.back), is exiting through the flat inner face that is cemented to the polarizing film (as opposed to exiting the outer face or the cylindrical edge close to the film).
BeamletOptics._is_static Method
_is_static(x)Returns true if the kinematic_trait_of x is Static.
BeamletOptics._orthogonal_basis_vector Method
normal3d(input)Returns a vector with unit length that is perpendicular to the input vector. The orientation is chosen deterministically to guarantee reproducible bases.
BeamletOptics._pseudo_cross2d Method
_pseudo_cross2d(a, b, c)Calculates the triple product (a × b) ⋅ c using a non-conjugating dot product.
BeamletOptics._pseudo_dot Method
_pseudo_dot(a, b)Calculates the non-conjugating dot product a ⋅ b = Σ aᵢbᵢ.
BeamletOptics._ray_to_plane_projection Method
_ray_to_plane_projection(plane_pos, plane_normal, ray)Projects a ray onto a plane defined by plane_pos and plane_normal. Returns the offset vector h (from plane_pos to projected point) and the projected ray slope u.
BeamletOptics._raymarch_inside Method
_raymarch_inside(object::AbstractSDF, pos, dir; num_iter=1000, dl=0.1)Perform the ray marching algorithm if the starting pos is inside of object.
BeamletOptics._raymarch_outside Method
_raymarch_outside(shape::AbstractSDF, pos, dir; num_iter=1000, eps=1e-10)Perform the ray marching algorithm if the starting pos is outside of shape.
BeamletOptics._refract_transmitted! Method
_refract_transmitted!(child, ray, dir)Sets the direction of the transmitted child ray of the coating to the refracted direction dir. For a PolarizedRay, the field is transformed into the new direction as well.
BeamletOptics._sampling_basis Method
_sampling_basis(dir, basis, T)Returns the unit-length reference vector that seeds the azimuthal sampling of a beam group. dir must already be normalized.
If basis is nothing, a vector normal to dir is picked deterministically via normal3d. Otherwise basis is projected into the plane normal to dir, which lets a caller rotate the sampling pattern of a source about its own axis.
Throws if basis has no significant component in that plane, i.e. if it is zero or parallel to dir. The test is relative to norm(basis) because projecting an unnormalized vector leaves a residual that scales with its length; an absolute tolerance would let a parallel basis through and yield NaN sampling.
BeamletOptics._tick! Method
_tick!(p::_LazyProgress)Count one finished item. Safe to call from any thread.
sourceBeamletOptics._transverse Method
_transverse(E0, dir)Removes the component of the field E0 along dir. For nearly parallel in- and out-directions, the s-p basis of _calculate_global_E0 is ill-conditioned and E0 would otherwise keep a small component along the direction of propagation.
BeamletOptics._with_progress Method
_with_progress(f, p::_LazyProgress)
_with_progress(f, progress::Bool, n, desc)Run f(p), which calls _tick!(p) once per finished item, and return its result. Afterwards the bar is completed. If f throws, e.g. an InterruptException from Ctrl-C, the bar is cancelled before the exception is rethrown, so no half-drawn bar is left behind. In both cases later ticks draw nothing.
BeamletOptics._world_to_sdf Method
_world_to_sdf(sdf, point)Transforms the coordinates of point into a reference frame where the sdf lies at the origin. Useful to represent translation and rotation. If rotations are applied, the rotation is applied around the local sdf coordinate system.
BeamletOptics.align3d! Method
align3d!(x, target)Rotates x about its position such that its direction is aligned with target. See BeamletOptics.Movable.
BeamletOptics.align3d Method
align3d(start::AbstractVector, target::AbstractVector)Returns the rotation matrix R that will align the start vector to be parallel to the target vector. Based on 'Avoiding Trigonometry' by Íñigo Quílez. The resulting matrix was transposed due to column/row major issues. Vector length is maintained. This function is very fast.
sourceBeamletOptics.angle3d Function
angle3d(ray::AbstractRay, intersect::Intersection=intersection(ray))Calculates the angle between a ray and its or some other intersection.
BeamletOptics.angle3d Method
angle3d(target::AbstractArray, start::AbstractArray, reference::AbstractArray)Returns the angle between the target and start vector in rad. In addition, a reference axis must be specified. This axis is used in order to determine the angle sign of rotation according to the right hand rule.
BeamletOptics.angle3d Method
angle3d(target::AbstractVector, start::AbstractVector)Returns the angle between the target and start vector in rad.
BeamletOptics.arrow! Method
arrow!(ax, pos, dir; scale=1, kwargs...)Draws a single 3D arrow from pos pointing along dir into ax, if a suitable backend is loaded, scaled to a fixed on-screen length (independent of dir's own norm) so it stays legible next to CAD geometry. If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.aspheric_equation Method
aspheric_equation(r, c, k, α_coeffs)
The aspheric surface equation. The asphere is defined by:
c: The curvature (1/radius) of the surfacek: The conic constant of the surfaceα_coeffs: The (even) aspheric coefficients, starting with A4.
This function returns NaN if the square root argument becomes negative.
Note
Only even aspheres are implemented at the moment. This will change soon.
sourceBeamletOptics.base_transform Function
base_transform(base, base2=I(3))Return the base transformation matrix for transforming from vectors given relative to base2 into base.
BeamletOptics.bounding_sphere Method
bounding_sphere(sdf)Returns nothing or a center point and the radius of a sphere which encloses the shape of the SDF. This function is currently only used for rendering SDFs but might be used in the future to optimize the raymarching algorithm, by tracing against the bounding sphere of and SDF first, instead of calling the more costly complex SDF.
BeamletOptics.bounding_sphere Method
bounding_sphere(d::DifferenceSDF)Returns the bounding_sphere of d.base — the result of a subtraction is always a subset of the base, so the base's bounding sphere (or nothing, if it has none) also bounds d.
BeamletOptics.calc_center_point Method
calc_center_point(::AbstractCenterAlgorithm, xs::Vector{T}, zs::Vector{T}, projection_factor::Vector{T}) where TCalculates a central 2D point based on a distribution of points, specified by xs and zs. The algorithm can be selected by specifying a concrete AbstractCenterAlgorithm. In addition, projection factors for each hit point can be passed.
Returns (x0, z0).
BeamletOptics.calc_local_lims Method
calc_local_lims(pd::Detector; kwargs...)Calculates the limiting values for the flat E-field evaluation grid based on the detector data.
sourceBeamletOptics.calc_local_lims Method
calc_local_lims(pd::Detector, hits::Vector{GaussianBeamletHit}; crop_factor=1, num_spots=50, kwargs...)Computes a 2D bounding box around the circular or elliptical waist of GaussianBeamlet hits. Assumes that the beamlet is approximately cylindrical around its optical axis at the point of intersection.
Keyword arguments
For available keyword args., refer to the corresponding calc_local_pos function.
BeamletOptics.calc_local_lims Method
calc_local_lims(pd::Detector, hits::Vector{<:AbstractRayHit}; crop_factor=1, center=Centroid())Compute a symmetric [x_min,x_max]×[z_min,z_max] box around the hit positions weighted centroid for ray-based spot diagrams.
• If center==Centroid() (the default), uses x0 = ∑ wᵢ·xᵢ / ∑ wᵢ, z0 = ∑ wᵢ·yᵢ / ∑ wᵢ with wᵢ = projection_factor. • If center==MinMax(), falls back to the midpoint of [min,max].
Returns (x_min, x_max, z_min, z_max).
BeamletOptics.calc_local_pos Method
calc_local_pos(pd::Detector; kwargs...)Calculates the hit position of all registered hits in local detector coordinates.
sourceBeamletOptics.calc_local_pos Method
calc_local_pos(pd::Detector, hits::Vector{AstigmaticGaussianBeamletHit}; crop_factor=1, num_spots=50)Calculates a projected ellipse of 2D hit spots for each hit of an AstigmaticGaussianBeamlet on the Detector.
BeamletOptics.calc_local_pos Method
calc_local_pos(pd::Detector, hits::Vector{GaussianBeamletHit}; crop_factor=1, num_spots=50)Calculates a projected circle or ellipse of 2D hit spots for each hit of a GaussianBeamlet on the Detector. The spot coordinates are returned in a left-handed (x, z) coordinate system where the detector surface normal points towards the incoming beamlets.
Keyword arguments
crop_factor=1: scales the beam waist radius used to determine the bounding boxnum_spots=50: determines the number of 2D hits used to determine the bounding circle/ellipse
BeamletOptics.check_optical_invariant Method
check_optical_invariant(agb, i; threshold = get_invariant_threshold())Evaluate the complex optical invariant h1 . u2 - h2 . u1 = 0 at segment i. Returns true if the invariant holds (within threshold), and false otherwise.
BeamletOptics.children! Method
children!(beam::B, child::B) where {B<:AbstractBeam}Handles the inclusion of adding a single child to an existing beam. The function behaves as follows:
If no previous children exist, add child
If
beamalready has a single child, modify child beam starting ray (retracing)Else throw error
BeamletOptics.convex_aspheric_surface_distance Method
convex_aspheric_surface_distance(r, z, c, k, d, α_coeffs)Calculates the 2D distance field for an aspheric surface at radius r away from the optical axis position z. The asphere is defined by:
c: The curvature (1/radius) of the surfacek: The conic constant of the surfaced: The diameter of the asphereα_coeffs: The (even) aspheric coefficients, starting with A2.
Note that this is not just an infinite aspheric surface and also not a surface segment but a closed 2D perimeter.
It is intended to pair the SDF derived from this distance field with a cylinder SDF to build a real lens.
sourceBeamletOptics.countlines_in_dir Function
countlines_in_dir(dir, ext=[".jl", ".md"])Counts the number of lines and files of all files in dir that have the specified file extension.
BeamletOptics.direction Method
direction(x)Returns the direction of x. For BeamletOptics.Oriented values this is the local y-axis, i.e. orientation(x)[:, 2]; rays and beams return their own direction.
BeamletOptics.direction Method
direction(ray::AbstractRay)Returns the direction vector of the ray.
BeamletOptics.edge_sag Method
Returns the sagitta of the surface at it edge, i.e. at diameter(s)
BeamletOptics.electric_field Function
electric_field(I::Real, Z=Z_vacuum, ϕ=0)Calculates the E-field phasor in [V/m] for a given intensity I and phase ϕ. Vacuum wave impedance is assumed.
BeamletOptics.electric_field Method
electric_field(agb, r, z)Convenience wrapper for parabasal_field using the beamlet's starting position (z=0) as the reference normalization.
BeamletOptics.electric_field Method
electric_field(pd::Detector; kwargs...)Compute a two‐dimensional electric field based on incoming rays or beams as captured by a Detector. The returned E-field map is sampled on a regular n×n grid in the detector's local (x,z)-plane. Note that the pd local coordinates are given in a (x, z) basis where the normal vector forms a left-handed system.
Resetting detectors
Be sure to call empty!(pd) before each new measurement if reusing the same detector.
Keyword Arguments
The following generic kwargs can be used for all hit types:
n::Int=100Number of sample points per axis.crop_factor::Real=1Scales the width of the sampling window returned bycalc_local_lims; values >1 expand, <1 shrink.x_min, x_max, z_min, z_maxManually override the sampling bounds in the local x or z directions. If left asInf, the bounds fromcalc_local_limsare used.x0_shift::Real=0, z0_shift::Real=0Applies a constant offset to the entire x or z coordinate arrays, useful for recentring or testing alignment.progress::Bool=trueShows a progress bar once the calculation has run forget_progress_threshold()seconds (default 5 s). It is only drawn ifstderris a terminal.
Ray specific keyword arguments
center::AbstractCenterAlgorithm=Centroid()How the sampling window is centred.Centroid()uses the projection‑weighted centroid,MinMax()uses the geometric mid‑point of the bounding box.
Scaling
The returned values for ray hits correspond to the E-field of the point spread function. The values are raw/unscaled and not equal to a Strehl ratio. This feature is not yet added. In future versions a pupil finder along with a Strehl estimator will be added.
Beamlet specific keyword arguments
num_spots::Int=50Number of hit spots used to determine bounding box
Returns
A tuple (xs, zs, E) where
xs::LinRange{T}andzs::LinRange{T}are the sampled coordinates in the detector's local x and z axes,E::Matrix{Complex{T}}is the corresponding raw/unscaled intensity map, except forPolarizedRayHits, see below.
PolarizedRayHit hits
For PolarizedRays, the per-ray E0 field vectors are added coherently as 3D vectors in global coordinates (not projected onto the detector plane), so E::Matrix{Point3{Complex{T}}}. No obliquity/projection factor is applied: unlike the scalar ray case, the relative projection between rays is already encoded in their vector directions. As with the scalar case, the result is raw/unscaled (E0 carries Fresnel/Jones amplitude factors but not ray-tube area or pupil-sampling density).
Unpolarized light
Since polarization states with orthogonal E0 do not interfere, an unpolarized PSF is not obtained from a single coherent trace. Instead, trace twice with orthogonal input polarizations (e.g. E0 = [1,0,0] and E0 = [0,0,1]) and incoherently add the resulting intensities, i.e. I_total = intensity(E_x) .+ intensity(E_z).
BeamletOptics.electric_field Method
electric_field(gauss::GaussianBeamlet, r, z)Calculates the electric field phasor [V/m] of the GaussianBeamlet at the radial and longitudinal positions r and z. This function also considers phase changes due to changes in the optical_path_length of the beamlet.
Warning
Note that z and r must be specified as cartesian distances. Using the optical path length for z can lead to false results.
BeamletOptics.electric_field Method
electric_field(r, z, E0, w0, w, k, ψ, R) -> ComplexF64Computes the analytical complex electric field distribution of a stigmatic TEM₀₀ Gaussian beam which is described by:
Arguments
r: radial distance from beam originz: axial distance from beam originE0: peak electric field amplitudew0: waist radiusw: local beam radiusk: wave number, equal to2π/λψ: Gouy phase shift (defined as!) R: wavefront curvature, i.e. 1/r (radius of curvature)
BeamletOptics.ellipse Method
ellipse(t, a, b, c)Returns a point in Rⁿ that lies on an n-dim. ellipse that is parametrized by
t: circumference control variable ∈ [0, 2π]a: center pointb, c: conjugate diameter vectors
BeamletOptics.find_zero_bisection Method
find_zero_bisection(f, a, b; tol=1e-10, max_iter=1000)Finds a root of the scalar function f on [a, b] using the bisection method. Requires sign(f(a)) ≠ sign(f(b)). Stops when abs(f(mid)) < tol or after max_iter iterations, returning the current midpoint.
Arguments
f: functionReal -> Reala: lower interval boundb: upper interval boundtol: absolute function tolerance (default1e-10)max_iter: maximum iterations (default1000)
Errors
Throws if there is no sign change on [a, b] or if convergence is not reached within max_iter.
BeamletOptics.first_ray Method
first_ray(beam::AbstractBeam)Returns the start ray on the optical axis of the beam; for beamlets the first chief ray. Defines the generic position and direction of the beam, which are used as the pivot for rotations.
BeamletOptics.fresnel_coefficients Method
fresnel_coefficients(θ, n)
Calculates the complex Fresnel coefficients for reflection and transmission based on the incident angle θ in [rad] and the refractive index ratio n = n₂ / n₁. Returns rₛ, rₚ, tₛ and tₚ.
Signs
Info
The signs of rₛ, rₚ are based on the definition by Fowles (1975, 2nd Ed. p. 44) and Peatross (2015, 2023 Ed. p. 78)
BeamletOptics.gauss_parameters Method
gauss_parameters(agb::AstigmaticGaussianBeamlet, z::Real)Compute the scalar Gaussian beam parameters at distance z. Returns a tuple (w1, w2, R1, R2, ψ, w01, w02) where:
w1,w2: beam radii along the principal axesR1,R2: radii of curvature along the principal axesψ: total Gouy phase shiftw01,w02: waist radii along the principal axes
BeamletOptics.gauss_parameters Method
gauss_parameters(gauss::GaussianBeamlet, z; hint::Union{Nothing, Tuple{Int, Vector{<:Real}}}=nothing)Calculate the local waist radius and Gouy phase of an unastigmatic Gaussian beamlet at a specific cartesian distance z based on the method of J. Arnaud (1985) and D. DeJager (1992).
Arguments
gauss: the GaussianBeamlet object for which parameters are to be calculated.z: the position along the beam at which to calculate the parameters.hint: an optional hint parameter for the relevant point/index of the appropriate beam segment. If not provided, the function will automatically select the ray.
Returns
w: local radiusR: curvature, i.e. 1/r where r is the radius of curvatureψ: Gouy phase (note that -atan definition is used)w0: local beam waist radius
BeamletOptics.gauss_parameters Method
gauss_parameters(gauss::GaussianBeamlet, zs::AbstractArray)Return the parameters of the GaussianBeamlet along the specified positions in zs.
BeamletOptics.get_view Method
get_view(ls)Returns the current camera view matrix of an LScene ls, if a suitable backend is loaded.
Handy at the REPL to freeze a view found interactively: rotate the scene by hand, call get_view(ax), and paste the printed matrix into the script as a literal passed to set_view.
If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.hide_axis Method
hide_axis(ls, hide::Bool=true)Hides the axis markers of an LScene ls, if a suitable backend is loaded. Can be toggled via hide. If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.install_agent_skill Function
install_agent_skill(dest = joinpath(pwd(), ".claude", "skills"))Copies the agent skill that ships with the installed BeamletOptics version into joinpath(dest, "beamletoptics") and returns that path. The skill teaches AI coding assistants (e.g. Claude Code) how to write BeamletOptics simulations.
The default dest is the project-level skill directory of Claude Code in the current working directory. Use e.g. joinpath(homedir(), ".claude", "skills") for a personal installation.
An existing beamletoptics skill in dest is replaced, so calling this function again after Pkg.update keeps the skill in sync with the installed package version. Local edits to the copy are lost.
File permissions
Pkg installs packages read-only. The copied files are made writable so that the copy can be edited and replaced later.
BeamletOptics.intensity Function
Calculates the intensity in [W/m²] for a given complex electric field vector E (e.g. a PolarizedRay field). Vacuum wave impedance is assumed.
BeamletOptics.intensity Function
Calculates the intensity distribution on the Detector via
where E is the electric field value and Z is the wave impedance. In general, vacuum wave impedance is assumed. This function returns a tuple (x, y, I). For more information on the available keyword arguments, refer to the electric_field documentation.
BeamletOptics.intensity Function
Calculates the intensity in [W/m²] for a given complex electric field phasor E. Vacuum wave impedance is assumed.
BeamletOptics.intensity Method
intensity(agb::AstigmaticGaussianBeamlet, r, z)Compute the optical intensity [W/m²] of the beamlet at position (r, z).
BeamletOptics.interact3d Method
interact3d(::AbstractSystem, bs::ThinBeamsplitter, agb::AstigmaticGaussianBeamlet, ray_id::Int)Models the interaction between a ThinBeamsplitter and an AstigmaticGaussianBeamlet. The reflection phase jump θᵣ = π is applied to the reflected child beam.
BeamletOptics.interact3d Method
interact3d(::AbstractSystem, bs::ThinBeamsplitter, gauss::GaussianBeamlet, ray_id::Int)Models the interaction between a ThinBeamsplitter and a GaussianBeamlet.
Reflection phase jump
The reflection phase jump is modeled here as θᵣ = π for simplicity. This is since in practice it will have only a relative effect on the signal at the detector for interferometric setups. The phase jump is applied to the reflected portion of any incoming beam that faces the ThinBeamsplitter normal vector, which assumes that the splitter has an unambigous normal, i.e. a 2D mesh. This is intended to model the effect of the Fresnel equations without full polarization calculus.
BeamletOptics.interact3d Method
interact3d(::AbstractSystem, object::AbstractObject, ::AbstractBeam, ::AbstractRay)Defines the optical interaction between an incoming/outgoing beam/ray of light and an optical element, must return an AbstractInteraction or nothing. The default behavior is that no interaction occurs, i.e. return of nothing, which should stop the system tracing procedure. Refer to the AbstractInteraction typedocs for more information on the return type value.
BeamletOptics.interact3d Method
interact3d(system, object, agb::AstigmaticGaussianBeamlet, ray_id)Generic dispatch: traces each component beam's ray through object independently. Returns nothing if any interaction fails; otherwise returns an AstigmaticGaussianBeamletInteraction.
BeamletOptics.interact3d Method
interact3d(system::AbstractSystem, object::AbstractObject, gauss::GaussianBeamlet{R}, ray_id::Int)Generic dispatch for the interact3d method of a GaussianBeamlet with an AbstractObject. Unless a more concrete implementation exists, the interaction of the Gaussian is assumed to be the interaction of the chief, waist and divergence rays with an object.
Returns
The interact3d method for the GaussianBeamlet must return a GaussianBeamletInteraction.
BeamletOptics.interact3d Method
Implements the ideal reflection of a PolarizedRay via the normal at the intersection point on an optical surface. A Jones matrix of [-1 0 0; 0 1 0] is assumed as per Peatross (2015, 2023 Ed. p. 154) and Yun et al. (see PolarizedRay for more information).
BeamletOptics.interact3d Method
interact3d(AbstractReflectiveOptic, Ray)Implements the reflection of a Ray via the normal at the intersection point on an optical surface.
BeamletOptics.interact3d Method
Implements the refraction of a PolarizedRay at an uncoated optical surface. The "outside" ref. index is obtained from the system unless specified otherwise. Reflection and transmission values are calculated via the fresnel_coefficients. Stray light is not tracked. In the case of total internal reflection, only the reflected light is traced.
BeamletOptics.interact3d Method
Implements the refraction of a Ray at an optical surface. The "outside" ref. index is obtained from the system unless specified otherwise. At the critical angle, total internal reflection occurs (see refraction3d).
BeamletOptics.interact3d Method
interact3d(system::AbstractSystem, lp::LinearPolarizer, beam::Beam, ray::AbstractRay)Dispatches the optical interaction between a Beam/AbstractRay and a LinearPolarizer depending on which sub-shape (front, filter or back) was intersected.
Additional information
Cemented interface
The front and back substrates sit flush against the film. Refraction at the outer, uncoated surfaces is handled by the standard AbstractRefractiveOptic interaction logic. When a ray reaches the flat inner face cemented to the film, the film's Jones matrix is applied to the field before it is refracted (or, in case of total internal reflection, reflected without crossing the film) directly from the current substrate's refractive index into the other substrate's.
BeamletOptics.intersect3d Method
intersect3d(object::AbstractObject, ray::AbstractRay)In general, the intersection logic between an AbstractObject and an AbstractRay depends on the AbstractShapeTrait. Refer to the respective documentation.
BeamletOptics.intersect3d Method
intersect3d(sphere::AbstractSphere, ray::Ray)Intersection algorithm for sdf based shapes.
sourceBeamletOptics.intersect3d Method
intersect3d(shape::AbstractShape, ::AbstractRay)Defines the intersection between an AbstractShape and an AbstractRay, must return an Intersection or nothing. The default behavior for concrete shapes and rays is to indicate no intersection, that is nothing, which will inform the tracing algorithm to stop. Refer to the Intersection documentation for more information on the return type value.
BeamletOptics.intersect3d Method
intersect3d(mesh::Mesh, ray::Ray)This function is a generic implementation to check if a ray intersects the mesh.
BeamletOptics.intersect3d Method
intersect3d(plane_position, plane_normal, ray)Returns the intersection between a ray and an infinitely large plane which is characterized by its position and normal.
BeamletOptics.iscircular Method
iscircularTests if the polarization state is circular. Refer to Yun paper.
sourceBeamletOptics.iselliptical Method
isellipticalTests if the polarization state is elliptical.
sourceBeamletOptics.isentering Method
isentering(ray)Tests whether the ray is entering a shape based on the orientation of the ray direction and surface normal. If no intersection is present, default behavior is to return false.
BeamletOptics.isinfrontof Method
isinfrontof(point::AbstractVector, pos::AbstractVector, dir::AbstractVector)Tests if a point is in front of the plane defined by the position and direction vectors.
BeamletOptics.isinfrontof Method
isinfrontof(shape::AbstractShape, ray::AbstractRay)A simple test to check if a shape lies "in front of" a ray. The forward direction is here defined as the ray orientation. Only works well if ray is outside of the volume of shape. Can be dispatched to return more accurate results for subtypes of AbstractShape.
BeamletOptics.islinear Method
islinearTests if the polarization state is linear. Refer to Yun paper.
sourceBeamletOptics.isorthogonal3d Method
isorthogonal3d(v1, v2; atol=eps())Tests if v1 and v2 are orthogonal. Additional abs. tolerance can be passed via atol
BeamletOptics.isparallel3d Method
isparallel3d(v1, v2; atol = √eps)Tests if v1 is parallel (or anti-parallel) to v2, i.e. if the sine of the angle between both vectors, norm(cross(v1, v2)) of the normalized vectors, is at most atol.
BeamletOptics.isparaxial Function
isparaxial(system, gb::GaussianBeamlet, threshold=π/4)Tests the angle between the waist and divergence beams and refractive surfaces. A target threshold of π/4 or 45° is assumed before abberations become dominant.
sourceBeamletOptics.isparaxial Function
isparaxial(system, beam, threshold=π/4)Tests the angle between the beam direction and surface normal at each intersection. Mainly intended as a check for GaussianBeamlet.
BeamletOptics.isparentbeam Method
isparentbeam(beam, ray)Tests if the given beam contains the ray as a part of its solution.
BeamletOptics.istilted Method
istilted(system::System, gb::GaussianBeamlet)Tests if refractive elements are tilted with respect to the beamlet optical axis, i.e. introduce simple astigmatism.
sourceBeamletOptics.kinematic_trait_of Method
kinematic_trait_of(x) -> AbstractKinematicTraitReturns the AbstractKinematicTrait of x. Defaults to Static(). Movable types declare Movable(Oriented()) or Movable(Directed()).
BeamletOptics.kinematic_trait_of Method
kinematic_trait_of(c::AbstractCompositeSDF)A composite takes the kinematic class of its operands, which the constructor ensures to be either all static or all movable, see BeamletOptics.AbstractKinematicTrait.
BeamletOptics.lensmakers_eq Method
lensmakers_eq(R1, R2, n)Calculates the thin lens focal length based on the radius of curvature R1/R2 and the lens refractive index n. If center of sphere is on left then R < 0. If center of sphere is on right then R > 0.
BeamletOptics.line_plane_distance3d Method
line_plane_distance3d(plane_position, plane_normal, line_position, line_direction)Returns the distance between a line and an infinitely large plane which are characterized by their position and normal/direction.
BeamletOptics.line_point_distance3d Method
line_point_distance3d(pos, dir, point)Computes the shortes distance between a line described by pos+t*dir and a point in 3D. This function is slow and should be used only for debugging purposes.
BeamletOptics.line_point_distance3d Method
line_point_distance3d(ray, point)Returns value for the shortest distance between the ray (extended to ∞) and point.
BeamletOptics.list_subtypes Function
list_subtypes(T::Type; max_depth::Int=5)Prints a tree of all subtypes, e.g. list_subtypes(AbstractObject). Maximum exploration depth can be limited by passing max_depth. Returns the total number of types encountered.
BeamletOptics.look_at! Method
look_at!(ax, target, offset; up = [0, 0, 1])Aims the camera of ax at target from target + offset, if a suitable backend is loaded. A deterministic replacement for manually orbiting the scene to find a viewpoint, handy for reproducible close-up figures. If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.mechanical_diameter Method
Returns the mechanical diameter of the surface.
Note
It is assumed that mechanical_diameter(s) >= diameter(s) always holds.
sourceBeamletOptics.normal3d Method
normal3d(target, reference)Returns a vector with unit length that is perpendicular to the target and an additional reference vector. Vector orientation is determined according to right-hand rule.
sourceBeamletOptics.normal3d Method
normal3d(s::AbstractSDF, pos)Computes the normal vector of s at pos.
BeamletOptics.normal3d Method
normal3d(mesh::AbstractMesh, fID::Int)Returns a vector with unit length that is perpendicular to the target `face`` according to the right-hand rule. The vertices must be listed row-wise within the face matrix.
sourceBeamletOptics.numerical_aperture Function
numerical_aperture(θ, n=1)Returns the NA for a opening half-angle θ and scalar ref. index n. For more information refer to this website.
BeamletOptics.objects Method
objects(group::ObjectGroup)Exposes all objects/subgroups stored within the group.
sourceBeamletOptics.objects Method
Exposes all objects stored within the system. By exposing the Leaves of the tree only, it is ensured that AbstractObjectGroups are flattened into a regular vector.
BeamletOptics.op_extrude_x Method
op_extrude_x(p, sdf2d::Function, height)Calculates the SDF at point p for the given 2D-SDF function and extrudes the shape to height along the x-axis.
BeamletOptics.op_extrude_z Method
op_extrude_z(p, sdf2d::Function, height)Calculates the SDF at point p for the given 2D-SDF function and extrudes the shape to height along the z-axis.
BeamletOptics.op_revolve_y Method
op_revolve_y(p, sdf2d::Function, offset)Calculates the SDF at point p for the given 2D-SDF function with offset by revolving the 2D shape around the y-axis.
BeamletOptics.op_revolve_z Method
op_revolve_z(p, sdf2d::Function, offset)Calculates the SDF at point p for the given 2D-SDF function with offset by revolving the 2D shape around the z-axis.
BeamletOptics.operands Function
operands(c::AbstractCompositeSDF)Returns a Tuple of every child AbstractSDF that the composite c combines, in any order. This is the accessor the shared kinematics of AbstractCompositeSDF iterate over, so every concrete composite must implement it; the order carries no meaning and must not be relied upon to identify an operand's role in the boolean expression.
BeamletOptics.optical_path_length Method
optical_path_length(ray::AbstractRay{T}) where {T}Calculate the optical path length of the ray, i.e.
BeamletOptics.optical_path_length Method
optical_path_length(beam::Beam)Calculate the optical path length of the beam, i.e.
BeamletOptics.optical_power Method
optical_power(agb)Compute the total integrated optical power of the beamlet. For a Gaussian beamlet, this is typically constant through lossless propagation.
sourceBeamletOptics.optical_power Method
optical_power(pd::Detector; kwargs...)Calculates the total optical power on pd in [W] by integration over the local intensity. For more information on keyword argument options, refer to the electric_field docs.
BeamletOptics.orientation! Method
orientation!(bg::AbstractBeamGroup, M)Overwrites the orientation matrix of the beam group bg with M, see orientation.
Warning
This only sets the bookkeeping of the group, the beams are not moved. Use rotate3d! to rotate a group including its beams. M is not validated and must be a right-handed orthonormal matrix.
BeamletOptics.orientation Method
orientation(bg::AbstractBeamGroup) -> SMatrix{3,3}Returns the orientation matrix of the beam group bg. Its columns are the local x-axis (the azimuthal sampling reference vector), the local y-axis (the central source direction, see direction) and the local z-axis, forming a right-handed orthonormal basis.
The orientation tracks the full rotational state of the group, including a roll about its own optical axis. It is updated by rotate3d! and returned to the identity by reset_rotation3d!.
BeamletOptics.orientation Method
orientation(object) -> MatrixReturns the current orientation of the object in R³ as a matrix. The matrix represents the local fixed-body coordinate system.
In general, orientation(object) returns orientation(shape(object)) unless specified otherwise.
BeamletOptics.orientation Method
Enforces that shape has to have the field dir or implement orientation().
BeamletOptics.parabasal_field Method
parabasal_field(agb, r, z; E_ref_amp, area_ref, z_norm)Compute the complex scalar electric field of the AstigmaticGaussianBeamlet at a transverse offset r (a 3D vector in the plane perpendicular to the chief ray) and longitudinal position z.
Uses the built-in normalization √(area_ref / area(z)) so that the result is physical [V/m] when E_ref_amp matches the initial polarization amplitude.
Arguments
agb: the astigmatic Gaussian beamletr: transverse offset vector (must be orthogonal to the chief ray direction atz)z: distance along the beamE_ref_amp: reference field amplitude (auto-computed fromz_normifnothing)area_ref: reference area (auto-computed fromz_normifnothing).z_norm: longitudinal position for reference normalization (default: 0).
Formalism
The field is computed using the Parabasal Gaussian Beamlet formalism: ψ(r, z) = √(area_ref / area(z)) * exp(i * k * [z + 1/2 * rᵀ * Q(z) * r]) where area(z) = (h1 × h2) · dir is the complex beam area.
sourceBeamletOptics.parabasal_ray_parameters Method
parabasal_ray_parameters(agb, p0, i)Compute the complex parabasal ray parameters (h1, u1, h2, u2) at the transverse plane defined by the chief ray's position p0 and direction at segment i.
The real parts of h and u come from the divergence rays (dxp, dyp), while the imaginary parts come from the waist rays (wxp, wyp).
BeamletOptics.parabasal_ray_parameters Method
parabasal_ray_parameters(agb, z)Compute the parabasal ray parameters at distance z along the beam.
BeamletOptics.parent! Method
parent!(child::AstigmaticGaussianBeamlet, parent::AstigmaticGaussianBeamlet)Links parent for tree navigation and ensures the chief beam parent is also linked.
sourceBeamletOptics.parent! Method
parent!(beam::GaussianBeamlet, parent::GaussianBeamlet)Ensures that the GaussianBeamlet knows about its parent beam. In addition, links the chief beams of child and parent. Important for correct functioning of point_on_beam and length.
BeamletOptics.point_on_beam Method
point_on_beam(beam::Beam, t::Real)Function to find a point given a specific distance t along the beam. Return the ray index aswell. For negative distances, assume first ray backwards.
BeamletOptics.polarized_field Method
polarized_field(agb, r, z)Compute the complex vector electric field [V/m] of the AstigmaticGaussianBeamlet at position (r, z). Returns a 3D vector.
BeamletOptics.radius Method
Returns the radius of curvature of the surface. This might return Inf for planar surfaces or surfaces which cannot be described by just one curvature radius.
BeamletOptics.radius Method
Returns the radius of curvature R = 2f of the parent conic at its vertex [m].
BeamletOptics.rayleigh_range Method
rayleigh_range(agb::AstigmaticGaussianBeamlet)Returns the Rayleigh range for the x and y axes of the beamlet as a tuple (z_rx, z_ry).
BeamletOptics.rayleigh_range Method
rayleigh_range(g::GaussianBeamlet; M2=1)Returns the Rayleigh range for the first beam section of the GaussianBeamlet g. Note: M2 is not stored in g during construction and must be specified by the user.
BeamletOptics.reflection3d Method
reflection3d(dir, normal)Calculates the reflection between an input vector dir and surface normal vector in R³. Vectors dir and normal must have unit length!
BeamletOptics.refraction3d Method
refraction3d(dir, normal, n1, n2)Calculates the refraction between an input vector dir and surface normal vector in R³. n1 is the "outside" refractive index and n2 is the "inside" refractive index. The function returns the new direction of propagation and a boolean flag to indicate if internal refraction has occured.
Vectors dir and normal must have unit length!
Total internal reflection
If the critical angle for n1, n2 and the incident angle is reached, the ray is reflected internally instead!
Arguments
dir: direction vector of incoming raynormal: surface normal at point of intersectionn1: index of ref. before refractionn2: index of ref. after refraction
BeamletOptics.refraction3d Method
refraction3d(ray, n2)Calculates the new direction of a ray entering into a new medium with ref. index n2.
BeamletOptics.render! Method
render!(axis, thing; kwargs...)The render! function allows for the visualization of optical system and beams under the condition that a suitable backend is loaded. This means that either one of the following packages must be loaded in combination with BeamletOptics via using:
GLMakie
preferred for 3D viewing
use
LSceneorAxis3environments
CairoMakie
preferred for the generation of high-quality .pngs
only
Axis3is supported
If no suitable backend is loaded, a MissingBackendError will be thrown.
Implementations reqs.
All concrete implementations of render! must adhere to the following minimal interface:
render!(axis, thing; kwargs...)
axis: an axis type of the union ofLSceneorAxis3thing: an abstract or concrete object or beam typekwargs: custom orMakiekeyword arguments that are passed to the underlying backend
Refer to the BeamletOptics extension docs for Makie for more information.
BeamletOptics.render_lcs! Function
render_lcs!(ax, pos, lcs; scale = 10, show_labels = false)
render_lcs!(ax, object; scale = 10, show_labels = false)Draws the local coordinate system of an object (or of an explicit pos/orientation pair) into ax as a red/green/yellow arrow triad, if a suitable backend is loaded. Useful to make the reference frame of an imported CAD mesh visible in the scene. If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.reset_rotation3d! Method
reset_rotation3d!(x)Rotates x about its position such that its orientation is the identity. Only available for BeamletOptics.Oriented values, see BeamletOptics.Movable.
BeamletOptics.reset_translation3d! Method
reset_translation3d!(x)Moves x such that its position is the global origin. See BeamletOptics.Movable.
BeamletOptics.retrace_system! Method
retrace_system!(system, beam)This function tries to reuse data from a previously solved beam in order to solve the system againg using a sequential approach.
Retracing
The retracing logic for an already solved beam loops over the rays and children and is as follows:
Begin
Test if current
rayhas a validintersection- If not, mark beam tail for cleanup and go to
End
- If not, mark beam tail for cleanup and go to
Recalculate the
intersectionIf a hint was provided by a previous interaction, use hinted object
Else, test against previous
intersection
Test if the
raystill has a validintersectionafter recalculation- If no object is hit, mark beam tail for cleanup and go to
End
- If no object is hit, mark beam tail for cleanup and go to
Interact
Recalculate the optical
interactionCatch hints provided for next
rayIf no
interactionoccurs, mark beam tail for conditional cleanup and go toEnd
Add the interaction to the current
beamIf another
rayfollows, modify the next starting position - Go toBeginElse mark children for cleanup, push new ray to
beamtail - Go toEnd
End
- If cleanup is required, do conditionally
remove all beam tail rays after current
rayremove all beam children
reset beam tail ray intersection to nothing
Retracing blocked beam paths
The implemented standard retracing procedure can handle beam path invalidations under certain conditions. However, one case that will lead to a silent error is if an element in the system is moved such that it blocks the beam path between two other elements. The retracer will not be able to detect this, since the testing of the previous intersection will return a valid intersection.
If this kind of situation must be modeled, e.g. in the case of an optical chopper wheel, retracing should be disabled.
BeamletOptics.retrace_system! Method
retrace_system!(system, agb::AstigmaticGaussianBeamlet; check_invariant=true, threshold = get_invariant_threshold())Retrace the beam stored in AstigmaticGaussianBeamlet through the optical system. All 9 component ray intersections and interactions are recalculated. All rays must hit the same object, or the retracing step is aborted.
BeamletOptics.retrace_system! Method
retrace_system!(system::System, gauss::GaussianBeamlet{T}) where {T <: Real}Retrace the beam stored in GaussianBeamlet through the optical system. Chief, waist and divergence ray intersections and interactions are recalculated. All rays must hit the same object, or the retracing step is aborted. If retracing is stopped before the end of the beam is reached, further rays are dropped.
BeamletOptics.rotate3d! Method
rotate3d!(x, R::AbstractMatrix)
rotate3d!(x, axis::AbstractVector, θ::Real)
rotate3d!(x, R::AbstractMatrix, pivot::AbstractVector)
rotate3d!(x, axis::AbstractVector, θ::Real, pivot::AbstractVector)Rotates x by the rotation matrix R (or by the angle θ [rad] about axis) about its own position, or about pivot if given. See BeamletOptics.Movable.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, beam::AbstractBeam, R::AbstractMatrix)Resets the root beam to its untraced start state and rotates it by R about its position (the chief ray start for beamlets). Composite beams delegate to their component beams. Throws an ArgumentError for child beams.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, bg::AbstractBeamGroup, R::AbstractMatrix)Rotates all beams of the group by R about the group center and updates the group orientation to R * orientation(bg). Every beam is reset to its untraced start state.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, c::AbstractCompositeSDF, R::AbstractMatrix)Rotates c and all of its operands around c's own origin (pivot), by the rotation matrix R.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, mesh::AbstractMesh, R::AbstractMatrix)Rotate the mesh vertices and orientation around its current position using R.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, shape::AbstractShape, R::AbstractMatrix)Rotates the dir-matrix of shape by the rotation matrix R.
BeamletOptics.rotate3d! Method
rotate3d!(::MultiShape, object, R::AbstractMatrix)All parts of the MultiShape object are rotated around the pivot center via the rotation matrix R.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, ray::AbstractRay, R::AbstractMatrix)Rotates the direction of the ray by R about its own start position and clears its intersection. Subtypes carrying direction-dependent data (e.g. the field vector of a PolarizedRay) dispatch their own method that also rotates this data.
BeamletOptics.rotate3d! Method
rotate3d!(::Movable, ray::PolarizedRay, R::AbstractMatrix)Rotates the direction and the field vector E0 of the ray by R about its start position and clears its intersection. E0 stays orthogonal to the direction and is not renormalized, i.e. its amplitude is kept.
BeamletOptics.rotate3d Method
rotate3d(reference::Vector, θ)Returns the rotation matrix that will rotate a vector around the reference axis at an angle θ in radians. Vector length is maintained. Counter-clockwise rotation in a right-hand coord. system. The reference axis is normalized internally, i.e. it can have any non-zero length.
BeamletOptics.sag Method
sag(r::Real, l::Real)Calculates the sag of a cut circle with radius r and chord length l
BeamletOptics.scale3d! Method
scale3d!(mesh::AbstractMesh, scale)Allows rescaling of mesh data around "center of gravity".
sourceBeamletOptics.sd_line_segment Method
sd_line_segment(p, a, b)Returns the signed distance from point p to the line segment described by the points a and b.
BeamletOptics.sdf Method
sdf(::AbstractRotationallySymmetricSurface, ::Union{Nothing, AbstractOrientationType})Takes the surface specification and an optional AbstractOrientationType as trait parameter and returns a corresponding AbstractSDF type.
Surface vs. volume based tracing
This function is a mere convenience provider for users coming from other optic simulations frameworks which are surface oriented. The goal of this function is to return the best matching closed volume SDF which posesses a surface with the given specs on one side and most often a boundary and planar surface on the other side.
Info
Always keep in mind that this package performs closed-volume baced ray tracing using either SDFs or meshes.
BeamletOptics.set_new_origin3d! Method
set_new_origin3d!(mesh::AbstractMesh)Resets the mesh directional matrix and position vector to their initial values.
Warning: this operation is non-reversible!
sourceBeamletOptics.set_orthographic Method
set_orthographic(ls)Switches the camera of an LScene ls to an orthographic projection, if a suitable backend is loaded. If not, a MissingBackendError will be thrown.
BeamletOptics.set_pivot3d! Method
set_pivot3d!(bg::AbstractBeamGroup, pivot)Moves the kinematic pivot (center) of the beam group bg to pivot, without moving or resetting any of its beams. The pivot is the reference point used by rotate3d! and reset_translation3d!; the group orientation is unchanged.
Unlike translate3d! or rotate3d!, this only changes bookkeeping and does not reset already traced beams.
BeamletOptics.set_pivot3d! Method
set_pivot3d!(group::ObjectGroup, pivot)Moves the kinematic pivot (center) of group to pivot, without moving any of its objects. The pivot is the reference point used by rotate3d!, translate_to3d! and reset_translation3d!; the group orientation is unchanged.
Example
Rotate a lens group about its first surface instead of the group's default center:
group = ObjectGroup([lens1, lens2])
set_pivot3d!(group, position(lens1))
rotate3d!(group, [0, 0, 1], deg2rad(5)) # rotates about lens1's position, not the old centerBeamletOptics.set_view Method
Sets the camera of an LScene ls, if a suitable backend is loaded, either directly from a view matrix (e.g. one obtained via get_view) or from an eye/lookat/up triple. See also look_at! to aim the camera at a known point instead of specifying the triple directly.
If no suitable backend is loaded, a MissingBackendError will be thrown.
BeamletOptics.shape Method
shape(::AbstractObject)Returns all component shapes of the object for a MultiShape or a single shape for a SingleShape. E.g. for a custom multi-shape object the user of this API needs to define:
BeamletOptics.shape(obj::MyObject) = (obj.front, obj.back)
Warning
Whenever your object consists of nested structures (e.g. ObjectGroups or other MultiShapes) it is the responsibility of the user to ensure that each atomic shape, i.e. SingleShape, is only listed once. Failure to ensure this can lead to spurious behaviour when using the kinematic API.
BeamletOptics.shift_phase! Method
shift_phase!(agb, Δϕ)Apply a global phase shift Δϕ to the AstigmaticGaussianBeamlet by rotating the chief ray's polarization.
BeamletOptics.solve_system! Method
solve_system!(system::AbstractSystem, bg::AbstractBeamGroup; progress=true, kwargs...)Trace every beam of the beam group bg through the system, multithreaded over the member beams. All other kwargs are passed on to solve_system! for each beam.
Keyword Arguments
progress = true: show a progress bar once tracing has run forget_progress_threshold()seconds (default 5 s). It is only drawn ifstderris a terminal, so documentation builds, CI logs and piped output stay clean.
BeamletOptics.solve_system! Method
solve_system!(system::System, beam::AbstractBeam; r_max=get_default_r_max(), retrace=true, depth_max=get_default_depth_max(), check_invariant=true, threshold=get_invariant_threshold())Manage the tracing of an AbstractBeam through an optical system. The function retraces the beam if possible and then proceeds to trace each leaf of the beam tree through the system. The condition to stop ray tracing is that the last beam intersection is nothing or the beam interaction is nothing. Then, the system is considered to be solved. A maximum number of rays per beam (r_max) can be specified in order to avoid infinite calculations under resonant conditions, i.e. two facing mirrors. Likewise, depth_max limits how many branching levels are explored when new sub-beams are generated (for example, by beamsplitters) so that the tree cannot grow without bound. Sub-beams beyond the depth limit are dropped from the tree.
Arguments
system::System: The optical system in which the beam will be traced.beam::AbstractBeam: The beam object to be traced through the system.
Keyword Arguments
r_max = get_default_r_max(): Maximum number of tracing iterations for each leaf.retrace = true: Flag to indicate if the system should be retraced. Default is true.depth_max = get_default_depth_max(): Maximum number of branching levels explored from the root beamcheck_invariant = true: enables or disables optical invariant checks where applicablethreshold = get_invariant_threshold(): threshold for paraxial invariant checks
BeamletOptics.spot_diagram Method
spot_diagram(d::Detector)Returns an array of 2D points in local detector coordinates that represent the points of intersection for incoming beams.
Beams
For Beams, the point of intersection on the screen surface is stored.
Beamlets
For GaussianBeamlets, the projected 1/e² waist is returned. The number of points and radius can be adjusted via the num_spots and crop_factor keyword arguments.
BeamletOptics.test_refractive_index_function Method
test_refractive_index_function(input)Tests if input is callable with a single Real argument for the wavelength λ and returns a single Real value for the refractive index n.
BeamletOptics.test_refractive_index_function Method
DiscreteRefractiveIndex passes test by default
BeamletOptics.thickness Method
thickness(difference)Calculates the thickness of a DifferenceSDF as the thickness of its base — removing material cannot increase the axial extent.
BeamletOptics.thickness Method
thickness(union)Calculates the thickness of a union of AbstractLensSDFs.
BeamletOptics.trace_system! Method
trace_system!(system::AbstractSystem, beam::Beam{T}; r_max = get_default_r_max()) where {T <: Real}Trace a Beam through an optical system. Maximum number of tracing steps can be capped by r_max.
Tracing logic
The intersection of the last ray of the beam with any objects contained within the system is tested. If an object is hit, the optical interaction is calculated. If no interaction occurs or no further objects are hit, the tracing procedure is stopped.
Arguments
system:: The optical system through which theBeamis traced.beam: TheBeamobject to be traced.r_max: Maximum number of tracing iterations.
BeamletOptics.trace_system! Method
trace_system!(system, agb::AstigmaticGaussianBeamlet; r_max = get_default_r_max(), check_invariant = true, threshold = get_invariant_threshold())Trace an AstigmaticGaussianBeamlet through an optical system. All 9 component beams (chief + 8 parabasal) are traced in lockstep: the chief ray is traced first for each intersection, followed by the auxiliary rays. All rays must hit the same shape; otherwise tracing stops.
BeamletOptics.trace_system! Method
trace_system!(system::System, gauss::GaussianBeamlet{T}; r_max = get_default_r_max()) where {T <: Real}Trace a GaussianBeamlet through an optical system. Maximum number of tracing steps can be capped by r_max.
Tracing logic
The chief, waist and divergence beams are traced step-by-step through the system. For each intersection after a tracing_step!, the intersections are compared. If all rays hit the same target, the optical interaction is analyzed, else the tracing stops.
Arguments
system: The optical system through which theGaussianBeamletis traced.gauss: TheGaussianBeamletobject to be traced.r_max: Maximum number of tracing iterations.
BeamletOptics.tracing_step! Method
tracing_step!(system::AbstractSystem, ray::AbstractRay{R}, hint::Hint)Tests if the ray intersects an object in the optical system. Returns the closest intersection.
Hint
An optional Hint can be provided to test against a specific object (and shape) in the system first.
Warning
If a hint is provided and the object intersection is valid, the intersection will be returned immediately. However, it is not guaranteed that this is the true closest intersection.
BeamletOptics.translate3d! Method
translate3d!(x, offset)Moves x by the offset vector. See BeamletOptics.Movable.
BeamletOptics.translate3d! Method
translate3d!(::Movable, beam::AbstractBeam, offset)Resets the root beam to its untraced start state and moves it by offset. Composite beams delegate to their component beams. Throws an ArgumentError for child beams.
BeamletOptics.translate3d! Method
translate3d!(::Movable, bg::AbstractBeamGroup, offset)Moves all beams of the group and its center by offset. Every beam is reset to its untraced start state.
BeamletOptics.translate3d! Method
translate3d!(::Movable, c::AbstractCompositeSDF, offset)Translates c and all of its operands by offset.
BeamletOptics.translate3d! Method
translate3d!(::Movable, mesh::AbstractMesh, offset)Mutating function that translates the vertices of an mesh in relation to the offset vector. In addition, the mesh position vector is overwritten to reflect the new "center of gravity".
sourceBeamletOptics.translate3d! Method
translate3d!(::Movable, shape::AbstractShape, offset)Translates the position of shape by the offset-vector.
BeamletOptics.translate3d! Method
translate3d!(::MultiShape, object, offset)Moves all parts of the MultiShape object along the specified offset vector.
BeamletOptics.translate3d! Method
translate3d!(::Movable, ray::AbstractRay, offset)Moves the start position of the ray by offset and clears its intersection.
BeamletOptics.translate_to3d! Method
translate_to3d!(x, target)Moves x such that its position coincides with target. See BeamletOptics.Movable.
BeamletOptics.transmission_axis Method
transmission_axis(lp::LinearPolarizer)Returns the unit vector (in global coordinates) along which LinearPolarizer lp transmits polarization. Refer to transmission_axis(::PolarizationFilter) for details.
BeamletOptics.transmission_axis Method
transmission_axis(pf::PolarizationFilter)Returns the unit vector (in global coordinates) along which PolarizationFilter pf transmits polarization, derived from its Jones matrix so that it stays correct for any filter orientation or custom GlobalJonesBasis. The sign of the returned vector is arbitrary, since it represents an axis rather than a direction.
BeamletOptics.visibility Method
visibility(opt_pwr)Calculates e.g. the interferometric contrast from a series of optical power measurements. For more information go here.
sourceBeamletOptics.waist_parameters Method
waist_parameters(agb, z)Compute the position and elliptical waist axes at distance z along the beam. Returns (p0, w1, w2, w01, w02) where w1 and w2 are 3D vectors describing the semi-axes of the beam cross-section ellipse.
BeamletOptics.waist_parameters Method
waist_parameters(gb, z)Compute the position and cross-section axes at distance z along the beam. For a stigmatic GaussianBeamlet, the cross-section is circular, and the axes are determined by the orientation of the auxiliary waist ray. Returns the vectors (p0, w1, w2) and scalar waist radii (w0, w0).
BeamletOptics.xrotate3d! Method
xrotate3d!(x, θ)Rotates x by the angle θ [rad] about the global x-axis through its position. See BeamletOptics.Movable.
BeamletOptics.yrotate3d! Method
yrotate3d!(x, θ)Rotates x by the angle θ [rad] about the global y-axis through its position. See BeamletOptics.Movable.
BeamletOptics.zrotate3d! Method
zrotate3d!(x, θ)Rotates x by the angle θ [rad] about the global z-axis through its position. See BeamletOptics.Movable.
BeamletOptics.Config Module
ConfigGlobal configuration settings for the BeamletOptics package using Preferences.jl.
sourceBeamletOptics.Config.get_default_depth_max Method
get_default_depth_max()Returns the default maximum depth for recursive ray tracing (e.g., reflections/refractions). Defaults to 100 (configurable via the default_depth_max preference).
BeamletOptics.Config.get_default_power Method
get_default_power()Returns the default beam total power in Watts.
sourceBeamletOptics.Config.get_default_r_max Method
get_default_r_max()Returns the default maximum number of segments for ray tracing.
sourceBeamletOptics.Config.get_default_waist Method
get_default_waist()Returns the default beam waist radius in meters.
sourceBeamletOptics.Config.get_default_wavelength Method
get_default_wavelength()Returns the default wavelength in meters.
sourceBeamletOptics.Config.get_internal_reflection_threshold Method
Returns the global configuration threshold for total internal reflection detection.
sourceBeamletOptics.Config.get_invariant_threshold Method
get_invariant_threshold()Returns the global configuration threshold for the paraxial optical invariant check.
sourceBeamletOptics.Config.get_line_plane_intersection_threshold Method
Returns the global configuration threshold for line-plane intersection calculations.
sourceBeamletOptics.Config.get_orthogonality_threshold Method
get_orthogonality_threshold()Returns the global configuration threshold for orthogonality checks (e.g., beam support axes).
sourceBeamletOptics.Config.get_progress_threshold Method
get_progress_threshold()Returns the runtime in seconds after which long-running calls (solve_system! on a beam group, electric_field, intensity and optical_power on a detector) show a progress bar in the terminal. Defaults to 5 s (configurable via the progress_threshold preference, see set_progress_threshold!). Inf disables all progress bars.
BeamletOptics.Config.get_sdf_inside_step Method
get_sdf_inside_step()Returns the global configuration step size when inside an SDF volume.
sourceBeamletOptics.Config.get_sdf_raymarch_eps Method
get_sdf_raymarch_eps()Returns the global configuration epsilon for the SDF ray marching algorithm.
sourceBeamletOptics.Config.get_sdf_surface_threshold Method
get_sdf_surface_threshold()Returns the global configuration threshold for the Signed Distance Field (SDF) surface detection.
sourceBeamletOptics.Config.set_invariant_threshold! Method
set_invariant_threshold!(val::Real)Sets the global configuration threshold for the paraxial optical invariant check. This preference is persistent. Please restart Julia for this to take effect.
sourceBeamletOptics.Config.set_preference! Method
set_preference!(key::String, val; persistent=true)Helper to set preferences. Default is persistent.
sourceBeamletOptics.Config.set_progress_threshold! Method
set_progress_threshold!(val::Real)Sets the runtime in seconds after which long-running calls show a progress bar, see get_progress_threshold. Use Inf to disable progress bars globally. This preference is persistent. Please restart Julia for this to take effect.