3. Tour of Component Functions
3.1 Absorbers, Pinholes, and Slits
3.1.1 Using PinHole
3.1.2 Making a Slit with PinHole
3.1.3 The Absorption Generic Building Block
3.2.1 Using BeamSplitter
3.2.2 Using BeamSplitterCube
3.5.1 Making Three-Dimensional Abstract Graphics
3.5.2 Making an Arbitrary Polygon Graphic Shape
3.6.1 Using GratingSurface
3.6.2 The DiffractionMismatch Parameter
3.6.3 Using GratingMirror
3.6.4 Using SphericalGratingMirror
3.6.5 The DiffractionOrderNumber Parameter
3.6.6 Creating a Bragg Grating
3.6.7 Diffracting Several Colors
3.6.8 The Diffraction Generic Building Block
3.7.1 Spherical Lenses
3.7.2 Cylindrical Lenses
3.7.3 CustomLens
3.7.4 Window
3.7.5 The DesignWaveLength Option
3.7.6 Light through a Glass Ball
3.7.7 The Refraction Generic Building Block
3.8.1 Making a Hybrid Lens with LensSurface
3.8.2 Making a Compound Lens with LensSurface
3.9.1 The Simple Mirror
3.9.2 The Parabolic Mirror
3.9.3 The Polygonal Mirror
3.9.4 The Reflection Generic Building Block
3.10.1 Using ThinLens
3.10.2 Using ThickLens
3.10.3 Using ABCDOptic
3.10.4 The ABCDMatrix Generic Building Block
3.12.1 The Simple Prism
3.12.2 The Dove Prism
3.12.3 The Mirrored Dove Prism
3.13.1 The Transmission Generic Building Block
3.14 Building with Generic Building Blocks
3.14.1 Defining Screen
3.14.2 Defining Baffle
3.14.3 Defining BaffleWithHole
Introduction to Chapter 3
This chapter provides you with a tour of LensLab's built-in component functions, which are listed in the following table. In Chapter 5, you can learn how to create your own component functions using generic building blocks.
ABCDOptic CylindricalBaffle PlanoConcaveCylindricalLens
CylindricalLens PlanoConcaveLens
Baffle CylindricalLensSurface PlanoConvexCylindricalLens
BaffleSpan CylindricalMirror PlanoConvexLens
BaffleWithHole CylindricalScreen PolygonalMirror
BallLens PolygonGraphic
BallMirror DovePrism Prism
BeamSplitter DovePrismMirrored
BeamSplitterCube RectangleGraphic
BiConcaveCylindricalLens Fiber RodLens
BiConcaveLens RodMirror
BiConvexCylindricalLens GratingMirror
BiConvexLens GratingSurface Screen
Boundary SphereGraphic
BoxGraphic IntrinsicCylindricalSurface SphericalBaffle
BranchingSurface IntrinsicSphericalSurface SphericalGratingMirror
IntrinsicSurface SphericalLens
CircleGraphic SphericalLensSurface
ClearBoundary LensDoublet SphericalMirror
ConjugateMirror LensSurface SphericalScreen
CustomBaffle LensTriplet
CustomBeamSplitter ThickLens
CustomBranchingSurface Mirror ThinBaffle
CustomGratingSurface MirrorSpan ThinBeamSplitter
CustomIntrinsicSurface ThinLens
CustomLens ParabolicLensSurface ThinMirror
CustomLensSurface ParabolicMirror ThinParabolicMirror
CustomMirror ParabolicMirrorWithHole ThinSphericalMirror
CustomScreen PinHole
CylinderGraphic Pipe Window
Names of built-in component functions.
Loading LensLab
Make sure that the LensLab package is located either in the home directory, or on a directory path recognized by Mathematica for packages. The LensLab package is named LensLab.m and located in the LensLab directory, and the LensLab package is loaded with the following expression.
In[1]:=
Needs["LensLab`LensLab`"]
This loading process should only take a few seconds. In addition to being loaded as a package, the LensLab.m file is formatted as a Mathematica notebook. The LensLab source code is made accessible so that you can develop new functions of your own by studying LensLab's built-in functions. This is particularly helpful when you wish to model new component ideas in LensLab. However, you should receive permission from Optica Software before distributing any user-created functions that are derived from the LensLab source code. The unauthorized distribution of LensLab-derived code may be a LensLab license agreement violation or a copyright infringement.
3.1 Absorbers, Pinholes, and Slits
In this section, we examine absorbers, pinholes, and slits more closely. Here are definitions for LensLab's built-in absorbers, pinholes, and slits.
Baffle[aperture, thickness, options] designates a planar, double-surfaced component having two absorbing sides.
BaffleSpan[{x1, y1}, {x2, y2}, thickness, height, options] is similar to the Baffle except that its size and placement are specified by the two two-dimensional coordinates {x1,y1} and {x2,y2}.
BaffleWithHole[aperture, holeaperture, thickness, options] signifies a thick planar component with a hole created in its middle.
CustomBaffle[surfacefunction, aperture, objectlabel, options] refers to a single-surfaced, light absorbing component having a user-defined surface, and a user-named objectlabel.
CylindricalBaffle[radius, aperture, options] refers to a cylindrical, single-surfaced component that absorbs light.
PinHole[aperture, holeaperture, options] denotes a thin planar component with a hole created in its middle.
SphericalBaffle[radius, aperture, options] refers to a spherical, single-surfaced component that absorbs light.
ThinBaffle[aperture, options] designates a planar, single-surfaced component that absorbs light.
Component functions for absorber, pinholes, and slits.
For the remainder of this section, we look at some examples using pinholes and slits.
3.1.1 Using PinHole
We next use PinHole in an example. Here we use GraphicDesign -> Solid for solid rendering of PlanoConvexLens.
In[2]:=
sys = DrawSystem[{
CircleOfRays[20, NumberOfRays->6],
Move[PlanoConvexLens[100,50,10, GraphicDesign->Solid],100],
Move[PinHole[10,1],198],
Boundary[{0,-100,-100},{250,100,100}]}];
We look at the pinhole surface with PlotType -> Surface. From this we can see how closely the rays come to hitting the hole edges.
In[3]:=
ShowSystem[sys, PlotType->Surface, RayChoice->{ComponentNumber->2}];
We use the function FindSpotSize to get a quantitative measurement of the ray-bundle diameter at the pinhole entrance.
FindSpotSize[objectset, selectionproperties, options] takes an objectset containing Ray objects, and returns the diameter and position of a circle enclosing the locus of ray/surface intersection points that share the common set of traits specified in selectionproperties.
In[4]:=
FindSpotSize[sys,{ComponentNumber->2}]
Out[4]=
If we assume the units to be in millimeters for the optical system parameters, we see here that the bundle of rays has the diameter of .89 mm.
3.1.2 Making a Slit with PinHole
Next, we make a slit using PinHole with rectangular hole dimensions.
In[5]:=
DrawSystem[{
CircleOfRays[20,NumberOfRays->8],
Move[PinHole[{25,30},{1,25}],20],
Boundary[50]}];
3.1.3 The Absorption Generic Building Block
All of LensLab's built-in baffles use the Absorption generic building block to create absorptive ray-tracing functions. Here we define Absorption.
Absorption[component, options] is a generic building block that creates a ray-tracing function to absorb the intensity of rays hitting the optical surface.
You can use Absorption for building new types of absorbers. See Chapter 5 for more information about generic building blocks.
3.2 BeamSplitters
In this section, we examine beam splitters more closely. Here are definitions for LensLab's built-in beam splitters.
BeamSplitter[{percentreflected, percenttransmitted}, aperture, thickness, options] signifies a planar, double-surfaced component having a partially reflective/refractive side and a refractive side.
BeamSplitterCube[{percentreflected, percenttransmitted}, side, options] refers to a solid cube beam splitter having a partially reflective/refractive surface across its diagonal.
CustomBeamSplitter[surfacefunction, {percentreflected, percenttransmitted}, aperture, objectlabel, options] denotes a single-surfaced component that partially reflects and partially transmits rays of light, having a user-defined surface, and a user-named objectlabel.
ThinBeamSplitter[{percentreflected, percenttransmitted}, aperture, options] designates a planar, single-surfaced component that partially reflects and partially transmits rays of light.
Component functions for beam splitters.
For the remainder of this section, we look at some examples using beam splitters.
3.2.1 Using BeamSplitter
Here is an example using BeamSplitter. Also introduced by this example is PlotType -> ShadowProject. Be forewarned that the option ShadowProject takes a very long time to render. However, the results can be worthwhile.
In[6]:=
DrawSystem[{
ConeOfRays[10,NumberOfRays->10],
Move[PlanoConvexLens[100,50,10, CurvatureDirection -> Back, GraphicDesign->Wire],100],
Move[PlanoConvexCylindricalLens[100, {50, 50},10, GraphicDesign->Wire],130],
Move[BeamSplitter[{50,50},{50,50},10, GraphicDesign->Wire],180,45],
Boundary[{-100,-100,-100},{250,100,200}]},
PlotType->ShadowProject];
3.2.2 Using BeamSplitterCube
Next we use BeamSplitterCube in two examples. In the first, we use BeamSplitterCube with WedgeOfRays in a simple beam-splitting operation.
In[7]:=
DrawSystem[
{WedgeOfRays[30, NumberOfRays->6],
Move[BeamSplitterCube[{50,50},100],10],
Boundary[200]},Boxed->False];
In[8]:=
ShowSystem[%,PlotType->TopView];
In this second example, we test the ability of BeamSplitterCube to handle multisurface reflections.
In[66]:=
DrawSystem[
{Move[WedgeOfRays[45, NumberOfRays->6],{0,-30},45],
Move[BeamSplitterCube[{50,50},100],10],
Boundary[200]},PlotType->TopView];
You can learn how to build new components by studying LensLab's built-in component definitions, like BeamSplitterCube, from the LensLab package. This is discussed in more detail in Chapter 5.
3.3 Boundaries
In this section, we examine boundaries more closely. Boundaries are important for delineating bounds of the ray-trace system volume. For this reason, ray-trace systems usually have at least one boundary component listed at the end. These boundary components are not graphically rendered. Here are definitions for LensLab's built-in boundary components.
Boundary[boundaryparameters] signifies a rectangular box that absorbs rays intercepted by its walls.
ClearBoundary[boundaryparameters] refers to a rectangular box that terminates rays intercepted by its walls.
Boundary works by absorbing the intensity of rays that penetrate its surfaces. ClearBoundary, however, stops rays only when it is the last component listed for the system. ClearBoundary does not set the value of Intensity to zero, and therefore is useful for defining modular optical subunits to be pieced into a larger system.
There are three methods for specifying boundaryparameters:
Boundary[{x1, y1, z1}, {x2, y2, z2}] uses the coordinates of top and bottom opposite corners of a rectangular box, Boundary[side] assumes a cube boundary, and Boundary[xside, yside] assumes a three-dimensional box having a length specified by xside, a width specified by yside, and a height specified by yside.
If a boundary component is not given for a ray-trace system, each ray is terminated automatically at its last viable surface intersection point.
3.4 Fiber
Fiber was developed in order to model a stepped index optical fiber. Here we define Fiber.
Fiber[corediameter, claddingdiameter, length, options] designates a stepped index optical fiber.
As an example, we first render an optical fiber in three dimensions.
In[10]:=
DrawSystem[Fiber[5,10,100],Boxed->False];
Fiber is created with an end centered about x = 0 and with its length oriented along the x axis. The refractive core and cladding materials are given by the option, ComponentMedium -> {corematerial, claddingmaterial}. Section 6.6 shows how to create new refractive material models. For more information about the refractive index options, see Section 6.9. Next we trace a wedge of rays through the optical fiber.
In[11]:=
DrawSystem[{WedgeOfRays[10, NumberOfRays->6],
Move[Fiber[5,10,100],{5,0,0}],
Boundary[150]},PlotType->TopView];
Fiber actually contains ten distinct optical surfaces. Below, we use the tenth surface to examine the ray exit points at the fiber end.
In[12]:=
ShowSystem[%,PlotType->Surface, RayChoice->{SurfaceNumber->10}];
You can learn about creating new optical fiber designs in Section 5.4.
3.5 Graphic Shapes
LensLab has a number of built-in component functions that define graphic shapes for rendering. These graphical objects cannot directly interact with rays, but are useful for generating blueprints and showing component mounts. Here are definitions for LensLab's built-in graphical components.
BoxGraphic[{xmin, ymin, zmin}, {xmax, ymax, zmax}, options] signifies a three-dimensional rectangular box with its diagonally opposite corners placed at {xmin, ymin, zmin} and {xmax, ymax, zmax}.
CircleGraphic[aperture, options] relates to a two-dimensional circle, ellipse, rectangle, or polygon lying in the horizontal x-y plane, depending on the designation of aperture.
CylinderGraphic[diameter, length, options] denotes a three-dimensional cylinder with one circular center placed at the origin of the coordinate system, and its length pointing down the positive x axis.
PolygonGraphic[numberofsides, diameter, options] denotes a two-dimensional equilateral polygon lying in the horizontal x-y plane with its center placed at the origin of the coordinate system.
RectangleGraphic[{xmin, ymin}, {xmax,ymax}, options] designates a two-dimensional rectangle lying in the horizontal x-y plane with its diagonal corners placed at {xmin, ymin} and {xmax,ymax}.
SphereGraphic[diameter, options] signifies a three-dimensional sphere with its center placed at the origin of the coordinate system.
Component functions for generating graphic shapes.
Next we use abstract graphic shapes in two examples.
3.5.1 Making Three-Dimensional Abstract Graphics
In this example we produce abstract graphical objects in space using graphical shape components.
In[13]:=
DrawSystem[{
BoxGraphic[{0,0,0},{200,100,30}],
Move[CylinderGraphic[100,100],{100,100}],
SphereGraphic[150,GraphicDesign->Solid]}, Boxed->False];
3.5.2 Making an Arbitrary Polygon Graphic Shape
Although PolygonGraphic is useful for rendering regular-sided polygons, you can use CircleGraphic to generate arbitrary polygonal shapes by indicating the polygon corners as a list of coordinates in the aperture parameter. This can be useful in constructing blueprints. Here we use CircleGraphic to render a horizontal, four-sided shape in space.
In[14]:=
DrawSystem[CircleGraphic[{{-100,-100},{-100,100}, {-50,50},{0,100}}], PlotType->TopView];
You can learn more about specifying aperture shapes for components in Section 6.8.
3.6 Gratings
LensLab supports a number of grating components for modeling diffraction at a surface. If we assume that each ray represents a wave vector having a direction and phase, then each ray diffracts at a grating surface according to the value of the three-dimensional grating vector at each surface point. Here are definitions for LensLab's built-in grating components.
CustomGratingSurface[surfacefunction, gratingfunction, aperture, objectlabel, options] refers to a diffractive component that splits incoming rays into multiple diffracted orders according to the gratingfunction parameter and the DiffractedOrders option.
GratingMirror[gratingfunction, aperture, options] denotes a planar, diffractive, reflective component that splits incoming rays into multiple diffracted, reflected orders according to the gratingfunction parameter and the DiffractedOrders option.
GratingSurface[gratingfunction, aperture, options] designates a planar, diffractive component that splits incoming rays into multiple diffracted orders according to the gratingfunction parameter and the DiffractedOrders option.
SphericalGratingMirror[radius, gratingfunction, aperture, options] signifies a spherical, diffractive, reflective component that splits incoming rays into multiple diffracted, reflected orders according to the gratingfunction parameter and the DiffractedOrders option.
Component functions for modeling gratings.
In some cases, several diffracted rays are created for the different diffracted orders present. The surface grating may be represented either as a function of the surface coordinates or as a constant across the surface. Note that the physical curvature of the surface does not change the directions of the defined grating vector function. Instead, the grating vector function stays fixed in its directions, regardless of the underlying surface shape. For the remainder of this section, we look at some examples using gratings.
3.6.1 Using GratingSurface
An important grating component function is GratingSurface.
Here we use GratingSurface having a horizontal grating frequency of 1500 line pairs per millimeter.
In[15]:=
simplediffraction =
DrawSystem[{
Ray[],
Move[GratingSurface[1500,{100,100}],50],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
3.6.1 The DiffractionMismatch Parameter
The ray parameter DiffractionMismatch provides a measure of the ray's diffraction efficiency.
DiffractionMismatch is a rule of Ray returned by diffractive components that indicates the mismatch fraction of the diffracted ray and is defined as the difference in magnitude between the incident wave vector and the diffracted wave vector divided by the magnitude of the incident wave vector.
Here we check the efficiency of the last example.
In[16]:=
ReadRays[
simplediffraction,
DiffractionMismatch,
IntersectionNumber->2]
Out[16]=
Note that DiffractionMatch is placed in the Ray objects created from the diffraction surface interaction and therefore is only present in the following generation of Ray objects, for instance, IntersectionNumber -> 2.
3.6.3 Using GratingMirror
Next we use GratingMirror. GratingMirror works the same as GratingSurface, except that it has a reflective backing.
In[17]:=
DrawSystem[{
Ray[],
Move[GratingMirror[1500,{100,100}],50,30],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
3.6.4 Using SphericalGratingMirror
Gratings can also be put onto curved surfaces. Keep in mind, however, that the built-in grating function has a fixed direction that is formed independently of the surface contour. This is similar to the holographic interference of two plane waves on an arbitrary surface. Other grating functions may be defined by the user. Here we use SphericalGratingMirror.
In[18]:=
DrawSystem[{
LineOfRays[75, NumberOfRays->6],
Move[SphericalGratingMirror[-200, 500, 100],100],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
3.6.5 The DiffractionOrderNumber Parameter
The ray parameter DiffractionOrderNumber may be used to follow the graphical path of a single diffracted order.
DiffractionOrderNumber is a rule of Ray returned by diffractive components that indicates the order number of the particular diffracted ray.
Working with the last example, we restrict the display of rays to the first diffracted order.
In[19]:=
ShowSystem[%,PlotType->TopView, RayChoice->{DiffractionOrderNumber->0}];
3.6.6 Creating a Bragg Grating
In the previous cases, a simple horizontal grating vector was used to produce a horizontal diffraction that has a zero-order and a first-order diffracted beam. Here we create a Bragg diffraction grating used in a dielectric mirror or reflection hologram by changing the direction of the grating vector and increasing its spatial frequency.
In[20]:=
DrawSystem[{
Ray[],
Move[GratingSurface[{-3000,1000,0},{100,100},DiffractedOrders->{{1,1}}],50],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
In addition to making a Bragg diffracter, we have suppressed the zero-order beam by setting the option DiffractedOrders -> {{1,1}}.
3.6.7 Diffracting Several Colors
Next, we can see how a polychromatic ray diffracts through the first-examined grating structure.
In[21]:=
DrawSystem[{
RainbowOfRays[{.4,.7}, NumberOfRays->6],
Move[GratingSurface[1500,{100,100}],50],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
As another example, we will present a more complicated grating system that has several diffracted orders, accomplished by changing the DiffractedOrders option; it is also tilted relative to the incoming polychromatic beam.
In[22]:=
DrawSystem[{
RainbowOfRays[{.4,.7}, NumberOfRays->6],
Move[GratingSurface[1000,{100,100},DiffractedOrders->{{-1,1},{0,1},{1,1},{2,1}}],50,45],
Boundary[{-100,-100,-100},{100,100,100}]},PlotType->TopView];
3.6.8 The Diffraction Generic Building Block
Note that GratingSurface does not incorporate effects due to refraction or reflection, and only uses planar surfaces. Other variations, however, are simple to implement by using Diffraction, the parent generic function of GratingSurface, in combination with other object forms and generic building blocks. All of LensLab's built-in gratings use the Diffraction generic building block to create diffractive ray-tracing functions. Here we define Diffraction.
Diffraction[component, gratingfunction, options] is a generic building block that uses DeflectionFunction[ Diffraction, {diffractionvariables}] to produce diffracted rays through optical surfaces according to the gratingfunction parameter and the DiffractedOrders option.
You can use Diffraction for building new types of gratings. See Chapter 5 for more information about generic building blocks.
3.7 Lenses
In this section, we define LensLab's built-in lens functions. Due to the large numbers of lens functions, the definitions are grouped as spherical lenses, cylindrical lenses, the custom lens, and the window.
3.7.1 Spherical Lenses
BallLens[diameter, options] refers to an entire spherical refractive component.
BiConcaveLens[focallength, aperture, thickness, options] has two equally concave spherical surfaces.
BiConvexLens[focallength, aperture, thickness, options] has two equally convex spherical surfaces.
LensDoublet[r1, r2, r3, aperture, t1, t2, index1, index2, options] has three spherical surfaces.
LensTriplet[r1, r2, r3, r4, aperture, t1, t2, index1, index2, index3, options] has four spherical surfaces.
PlanoConcaveLens[focallength, aperture, thickness, options] has a planar surface on one side and a concave spherical surface on the other side.
PlanoConvexLens[ focallength, aperture, thickness, options] has a planar surface on one side and a convex spherical surface on the other side.
SphericalLens[r1, r2, aperture, thickness, objectlabel, options] has spherical surfaces given by two radii of curvatures.
Component functions for generating spherical lenses.
3.7.2 Cylindrical Lenses
BiConcaveCylindricalLens[focallength, aperture, thickness, options] has two equally concave cylindrical surfaces.
BiConvexCylindricalLens[focallength, aperture, thickness, options] has two equally convex cylindrical surfaces.
CylindricalLens[r1, r2, aperture, thickness, label, options] has cylindrical surfaces given by two radii of curvatures.
PlanoConcaveCylindricalLens[focallength, aperture, thickness, options] has a planar surface on one side and a concave cylindrical surface on the other side.
PlanoConvexCylindricalLens[focallength, aperture, thickness, options] has a planar surface on one side and a convex cylindrical surface on the other side.
RodLens[diameter, length, options] denotes an entire cylindrical refractive surface.
Component functions for generating cylindrical lenses.
3.7.3 CustomLens
CustomLens[f1, f2, aperture, thickness, objectlabel, options] has user-defined surfaces and a user-named objectlabel.
3.7.4 Window
Window[aperture, thickness, options] designates a planar, refractive component having a specified thickness.
3.7.5 The DesignWaveLength Option
DesignWaveLength is an option of most built-in lens functions that indicates the design wavelength value used in calculating the lens curvatures from the focal length specified.
3.7.6 Light through a Glass Ball
We now use BallLens in an example.
In[23]:=
ballsys = DrawSystem[{
LineOfRays[95,NumberOfRays->10],
Move[BallLens[100, SurfaceRendering -> {Empty,Fill,Fill,Fill}, GraphicDesign->Solid],50],
Boundary[{-100,-50,-100},{200,50,100}]}, Boxed->False];
Here we see the intersection points