Implementing components
This page explains which functions a solve calls on an optical component and what a developer implements for a new BeamletOptics.AbstractObject subtype. The geometry of a component lives in its shape, its optical effect in its BeamletOptics.interact3d method; the solver connects both in the Intersect-Interact-Repeat-Loop. For the components themselves, see Optical components.
Hooks called during a solve
The following diagram shows which functions a solve calls on an object. A new AbstractObject subtype implements interact3d always, and initialize!, bounding_sphere_of and shape only where the defaults or the existing shapes do not fit; it may also override the generic methods. initialize! runs only if the solve is called with initialize = true, for a beam group once before the first beam. How the loop chooses the next hit, including a Hint, is described in the Intersect-Interact-Repeat-Loop:
Interaction of the component families
The interact3d methods of the component families decide what follows a hit: a new ray, child beams, a recorded hit, a hand-over to the part of a composite that was hit, or the end of the beam. The solver calls the method for a beam with the hit ray; for a beamlet, the generic method calls it for each component beam. The families are grouped by their result:
A composite calls the interact3d method of the part that was hit directly and does not run the solver again. It returns the BeamInteraction of that part with a Hint to the part to be tested next, or nothing if the part returns nothing. Why the hint is needed at coincident boundaries is explained in Hints.