Rayica User Guide
Loading Rayica
A basic Rayica example
Inputting data
Modelling an optical system
Variable definition
Basic Commands
Using Options
Rayica's high-level functions
2. Modeling Optical Components and Light Sources
Modeling a light source
Ray versus TurboRays
How Rayica manages default light source settings
Modeling an optical component
3. Introduction to the AnalyzeSystem and TurboPlot
5. Using AnalyzeSystem for Ray Tracing
Tracing a single ray
Working with the ray-trace data
8. Adding a Cylindrical Lens to the System
10. Using Screen to Look at the Focal Plane
13. The PropagateSystem Function
14. Using TurboPlot for High-Speed Ray Tracing and Rendering
AnalyzeSystem versus TurboPlot
CreateClones
15. Optimization with OptimizeSystem
16. ReadRays with TurboTrace and TurboPlot
17. Energy Calculations with FindIntensity
2-D Calculations with FindIntensity
FindFocus
Measuring the Point Spread Function
Measuring the Modulation Transfer Function
1-D Calculations with FindIntensity
20. The TransferTraits Function
Features not discussed here
Features not covered in the basic package
Features left to the future
22. Backward Compatibility Issues
1. Introduction
Nearly every optical engineering endeavor can benefit from the use of Rayica, including but not limited to: optimization, lasers and resonators, non-sequential calculations, stray-light analysis, time-dependent optical systems, imaging systems, spectroscopic measurement, astronomical systems, solar concentrators, fiber-optic systems, opto-mechanical systems, polarization calculations, turbulent media, and photon-density calculations.
This guide will get you acquainted with Rayica's most important features. By learning the functions introduced here, you will have a good foothold for using Rayica. In particular, you will learn how to model optical components and light sources together for ray tracing as well as receive an overview of Rayica's most important capabilities. In addition to this User Guide, advanced information is provided in the companion
guide as well as through our website: www.opticasoftware.com. Before beginning, however, you must first load Rayica into memory.
Loading Rayica
The basic Rayica package is made up of two folders: Rayica and RayicaTools. The Rayica folder contains all of the essential files that make up Rayica while RayicaTools contains auxiliary functions for loading packages and working with Mathematica. Make sure that both the Rayica and RayicaTools folders are located together in a directory path recognized by Mathematica for packages. The Rayica package is loaded with the following command:
In[1]:=
Needs["Rayica`Rayica`"]
+++++++++++++++++++++++++
This loading process can take a minute or two, depending on your computer's speed. In addition to being loaded as a package, all of Rayica files are formatted as Mathematica notebooks. The Rayica source code is made accessible in the Rayica folder so that you can develop new functions of your own by studying Rayica's built-in functions. This is particularly helpful when you wish to model new component ideas in Rayica.
A basic Rayica example
The simplest way to learn Rayica is to experiment with its text-based interface. To this end, we have included a series of examples based on a simple optical system in this Introduction of the User Guide. The following series of examples will be used to demonstrate the elements necessary to create and analyze a basic optical system in Rayica. Each line of the initial example will be discussed in specific with references to later sections of this booklet for more extensive explanations of the functions used.
In[13]:=
TurboPlot[{
LineOfRays[45,NumberOfRays->11],
Move[PlanoConvexLens[100, 50, 10], 50],
Move[Screen[50], 200]
}]
Out[13]=
Inputting data
The first thing about this example to observe is the format. Because Rayica uses a text-based input system, it does not matter whether or not you include line breaks where they have been included. They have been put into this example for the sake of clarity. The generated image can be instantly resized by selecting a corner of the image and dragging the corner of the picture until in is the desired size.
Another important note about entering data in Rayica is that every function in Rayica has a specific input format. For example, the input format for TurboPlot is TurboPlot[system, options]. TurboPlot takes two different inputs: an optical system (system) and any option definitions (options). When any input variable contains multiple elements (in this case, an optical system) it is necessary to enclose those elements in curly brackets (“{}”). As with any mathematical system, it is important to close all brackets and parentheses appropriately or else the calculation will fail. Note that sometimes an input element is not required for final calculation. TurboPlot does not require that options be entered in order to perform a calculation (nor does any other function for that matter). It is always valuable to check a functions definition to see whether or not an input element is required for calculation or not.
Modelling an optical system
When entering an optical system into Rayica, you should consider what elements to include. To produce any meaningful result, it is necessary to have two things: light sources and optical components. More often than not, you will have only one light source but several components though only one of each has been included in this example. The light source is LineOfRays and the optical component is PlanoConvexLens. Another essential element of this system is the Screen. While not an optical element per se, the Screen provides a necessary function in that it intercepts all rays which come in contact with it without changing the optical properties of the ray.
Just as important as the components and light sources that you include in an optical system is their position in the system. As such, you will make almost constant use of the Move function. Move allows any object to be moved to any location or position within an optical system. For more information on the Move function and its uses, see Section 4 of this guide.
The ultimate use of an optical system in Rayica is analysis and/or display. If you are unsure of the function that you wish to use to analyze the optical system you have created, you can access a list of available functions using the RayicaFunctions command.
Basic Steps to follow when creating an optical system:
1) Determine what light source to use
2) Create a component list (see the Resonate section if you have any composite lenses)
3) Position the components in your list using the Move function
4) Bound the system using a Screen or a Boundary
5) Assign the resulting system to a variable
6) Use different high level functions to analyze the system as necessary
Variable definition
It is an excellent idea to assign the system to a variable as shown below.
In[14]:=
opticalsystem = {
LineOfRays[45,NumberOfRays->11],
Move[PlanoConvexLens[100, 50, 10], 50],
Move[Screen[50], 200]
}
Out[14]=
When an optical system is assigned to a variable, you can then use that variable to perform any number of calculations. It is always a good idea to assign an optical system to a variable if you intend to use the same system for repeated calculations as this can dramatically reduce input time. What is further, you can assign the output of a function to a variable as shown below
In[16]:=
tracedresult = TurboPlot[opticalsystem]
Out[16]=
Basic commands
If you already know the name of command that you want to include in your optical system but would like to review the definition before actually including it, you can use the ? command to display the definition.
In[11]:=
?PlanoConvexLens
The ? command works with all defined elements of Rayica, from functions to light sources to options. Almost anything that can be evaluated by Mathematica can be defined using the ? command.
Another very useful command is the % command. Use of % is discussed in the 10 minute introduction to Mathematica which you may wish to read. Essentially, % acts as a variable which stores the result of the previous calculation. So, if you wish to use the results of the last calculation performed, simply create a new input using % and evaluate it.
The final fundamental command is Options[ ]. When you enter a Rayica function name into the square brackets and press Shift+Enter, a list of the options associated with that function name are displayed. Finding a rule and applying it will be discussed in the next section.
In[12]:=
Options[Screen]
Out[12]=
Using Options
Options are available for almost every element of Rayica. To discover what options are associated with the elements that you are using, use the Options[] command as discussed in the Basic Commands section of this booklet. Options are assigned to Rayica elements using what is known as a rule (“->”) in Mathematica. What this means is that you select an option (or options) to assign a value (like PlotType in the following example) and then assign it a new value using the rule arrow.
In[17]:=
TurboPlot[tracedresult, PlotType->TopView]
Out[17]=
If you are unsure of what new values can be assigned to an option, you can use the ? command and the option’s name to determine what values can be assigned to that option.
In[18]:=
?PlotType
Rayica's high-level functions
Rayica has a number of functions available for high-level calculations. Some (but not all) of these functions are shown in the following table.
AnalyzeSystem[system, options] is used to trace rays through optical components and render the results for illustration purposes. This is also called DrawSystem.
PropagateSystem[system, options] is used by AnalyzeSystem to trace rays through optical components. This method is much slower than TurboTrace.
TurboTrace[optics, options] produces an accelerated ray trace of a system of light sources and optical elements.
TurboPlot[system, options] works with TurboTrace to perform accelerated ray-tracing and rendering of a system of light sources and optical elements.
ShowSystem[system, options] takes a system of rays and/or components and generates a graphical display of the system. ShowSystem works with AnalyzeSystem and TurboPlot results.
ReadRays[results, rayparameters, selectionproperties] takes ray-traced results from AnalyzeSystem/TurboPlot/TurboTrace and returns a list of values for the rayparameters and selectionproperties given.
OptimizeSystem[system, options] optimizes the performance of an optical system for a specified set of symbolic input parameters.
FindFocus[objectset, options] determines the minimum spot size for a locus of rays at the last reported surface in the system and plots the results.
FindSpotSize[objectset, options] determines the spot size for a locus of rays at the last reported surface in the system and plots the results.
FindIntensity[system, options] calculates the intensity function for each optical surface that gets reported from the ray trace of the system.
ModulationTransferFunction[intensitydata, options] calculates the modulation and phase transfer functions of an optical system for a given object source input.
Resonate[listofcomponents, objectname, options] is a generic building block that causes a ray to be nonsequentially traced within all of the surfaces defined by listofcomponents.
TransferTraits[donor-component, recipient-component, surfacenumbers, opts] is a function that transfers the surface traits of a donor component surface into the surfaces (specified by surfacenumbers) of a recipient component.
Rayica's most important high-level functions.
In various ways, these high-level functions assist the user in conducting the ray trace and interpreting the traced results. At the heart of every high level function in Rayica is the ray-trace calculation. For this, Rayica offers two parallel ways to trace rays through a system of optical elements in three-dimensional space, using either PropagateSystem or TurboTrace. In many cases, however, the ray-trace needs to be accompanied by a graphical rendering of the traced system. In such instances, either AnalyzeSystem or TurboPlot is called instead of PropagateSystem or TurboTrace. In other instances, ShowSystem is used to render isolated components or to rerender the results after the initial trace has taken place. ReadRays is used to extract numerical information from the traces previously conducted by AnalyzeSystem/PropagateSystem and TurboPlot/TurboTrace. The last five functions (OptimizeSystem , FindFocus, FindIntensity, ModulationTransferFunction, and TransferTraits) are the highest level functions of all and perform very specific tasks, as indicated by their given names.
Rayica offers four simple command tools that provide an overview of the functions used in the Rayica package: SourceFunctions, ComponentFunctions, MoveFunctions, and RayicaFunctions. These four commands create a list of the available light sources, optical components, move functions, and available optical functions respectively. For example, at any time that you wish while working with Rayica, you can access a listing of Rayica's primary high-level functions with the RayicaFunctions command:
In[7]:=
RayicaFunctions
In Mathmatica, RayicaFunctions gives you hyperlinks to Rayica's most important high-level functions. Clicking on any name will give you a description of its use.
Further, each of these lists is hyperlinked to the definitions of the different items contained in them. All you need to do is click on an item in the list to have its description displayed. In this Guide, we will explore many of these different functions in some detail. In some instances, this discussion serves as the primary reference for the subject matter. In other instances, however, the subject is discussed in more detail elsewhere. Next, we will learn how to create models of optical components and light sources.
2. Modeling Optical Components and Light Sources
Rayica has its own language for describing optical systems. In general, Rayica considers an optical system to be a collection of light sources and optical components. There are many different types of components and light sources in Rayica and each type is specified by a particular function. For example, a parallel light sheet is modeled by the LineOfRays function while a mirror is modeled by the Mirror function. After evaluation, these functions generate one of two special data structures that carry the optical properties. In particular, all component functions create a Component object, while all light source functions create a Source object. In this section, you will learn how to use component functions and light source functions to model optical components and light sources. Later on, you will learn how to define an optical system by listing together a combination of light sources and optical components. In particular, you will see that you can specify an optical system by placing your light sources and components in a list whose order describes the order of the light propagation through the optical components.
Coordinates
In Rayica, the X-axis runs in the horizontal direction, parallel to the computer screen, and is the default optical axis for optical systems, components within systems, and surfaces within components. The Z-axis encompasses the vertical direction and the Y-axis is right-handed with respect to the X and Z directions. Within an optical system, components and rays are located using the system's "world" coordinate system. Each surface within a component has its own local coordinate system and carries a three-dimensional rotation matrix plus a three-dimensional translation vector to transform a point or ray from the “world” coordinate system into the surface's local coordinate system, and back. This world-to-surface transform (matrix plus vector) is derived by combining the world-to-component and component-to-surface transforms during component initialization.
Modeling a light source
Next, we will take a closer look at light source functions. Rayica has a built-in series of functions that model different patterns of ray light sources. Here is a list of the most common built-in light source functions.
SingleRay[options] constructs a single ray of light with its starting position at the origin and is directed down the positive x axis.
CircleOfRays[seed, size, options] initializes a set of rays distributed on the surface of a tube that points down the positive x-axis.
ConeOfRays[seed, spread, options] initializes a set of rays distributed along a funnel-shaped surface that is oriented down the positive x-axis.
WedgeOfRays[seed, spread, options] initializes a set of rays in the x-y plane that fan out with their chief direction oriented down the positive x-axis and are distributed across the y-coordinate with the specified fan spread.
LineOfRays[seed, linewidth, options] initializes a set of rays in the x-y plane that point down the positive x-axis and are distributed along the y-coordinate with the specified linewidth.
GridOfRays[seed, size, options] initializes a set of rays distributed throughout a tube-shaped volume that points down the positive x-axis.
PointOfRays[seed, spread, options] initializes a set of rays distributed throughout a funnel-shaped volume that is oriented down the positive x-axis.
CustomRays[seed, {{name, vector}..}, options] initializes a set of user-defined rays.
GaussianBeam[beamspotsize, fulldivergence, options] and GaussianBeam[complexbeamparameter, options] is a light source that takes either the output beam spotsize radius (specified at 1/e of the axial value of the electric field amplitude peak in the starting plane) and far-field beam fulldivergence (specified as the full angle in radians at 1/e^2) or the complex beam parameter as input and creates an extended point source ray model of a Gaussian laser beam.
RainbowOfRays[seed, {minwavelength, maxwavelength}, options] initializes a set of overlapping rays that point down the positive x-axis and are distributed over the specified range of wavelengths, given in microns.
Ten commonly used light source functions.
At any time that you wish while working with Rayica, you can access a listing of Rayica's main high-level light source functions with the SourceFunctions command:
In[8]:=
SourceFunctions
In Mathmatica, SourceFunctions gives you hyperlinks to Rayica's most important light-source functions. Clicking on any name will give you a description of its use.
Most light sources in Rayica generate multiple rays of light. However, the simplest type of light source is the SingleRay function. This is designed for applications that require a single ray to be traced. When multiple rays are required, you could in principle specify a list of SingleRay functions for each ray, but it is always faster and more memory efficient to use one of the other built-in light source functions instead.
In Rayica, each light source function generates the information needed to describe a particular pattern of geometric rays. You can either store this generated information in an intermediate variable or immediately use it in a ray-trace calculation. Here is how you evaluate the SingleRay function and assign its information to a variable called lightsource.
In[16]:=
lightsource = SingleRay[]
Out[16]=
Rayica normally hides the contents of its light sources by echoing the function input back to the screen. For a first-time user of Rayica, this can be a bit disconcerting since it appears that nothing has occurred at all. For this reason, Rayica changes the returned text color (typically to green) for valid entries instead of using the default black color of ordinary Mathematica output. This color change indicates that the input has been correctly evaluated by Rayica. If there is no color change, then the function has not been recognized by Rayica and, most likely, there has been a typographical mistake. In addition, if you use InputForm, as shown below, you can see that the SingleRay function has actually generated a hidden packet of information that is encapsulated by a Source object.
In[3]:=
lightsource//InputForm
Out[3]//InputForm=
Source[{}, SourceDescription :> SourceDescription[SingleRay[{Ray[]}, 1, SourceTransformation ->
{{0., 0., 0.}, {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}}, SymbolicSourceTransformation ->
{{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}]], SourceTransformation :>
{{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}, SymbolicSourceTransformation :>
{{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}, SourceLevel :> {1, 1}, NumberOfRays :> 1, BirthPoint :> {0, 0, 0},
CoordinateSystem :> CartesianCoordinates, StartAtBirthPoint :> True, MonteCarlo :> False, SourceID :> 576,
SourceFraction :> 1, SourceOffset :> 0, GridSpacing :> (#1 & )]
Because the Source object is automatically created by all of the built-in light source functions, the user of Rayica never has to worry about the contents of this object. In fact, unless you use InputForm, as demonstrated here, you will never even see the contents of another Source object again after this discussion! Nevertheless, it is helpful to understand what happens when you evaluate a light source function (ie: it creates a Source object.) This information is used later by Rayica for ray-tracing. In the previous result, the "SingleRay[ ]" returned to the screen merely identified the type of function that generated the Source object, namely by SingleRay! In advanced forms of Rayica, this "self-echoing" feature enables Rayica to support GUI-mouse gestures in addition to the textual entry of optics. For the basic Rayica operation discussed here, however, we will only consider the textual entry of optics.
A Source object is not directly used for the ray-trace calculation. Rather, the Source information is only used at the start of the ray trace to initiate the rays for the trace. Essentially, the Source object informs Rayica how create the required rays at the start of the ray trace. In particular, the Source object indicates which type of function has created it (SingleRay in this case) and includes special instructions about how many rays are to be created as well as how to configure the created rays into a particular spatial pattern. All of Rayica's light source functions generate a Source object in the same fashion as SingleRay. Each light source function always creates a single Source object regardless of the actual number of rays used in the trace. After a ray trace has been carried out, specific information is usually returned about the optical surface intersections encountered by the rays in the trace. However, Source objects are only used to initiate the trace and are not used to store the resulting information from the ray trace. Instead, the traced rays are stored either as Ray objects (with AnalyzeSystem/PropagateSystem) or as TurboRays objects (with TurboPlot/TurboTrace). In the next section, you will learn more about Ray and TurboRays objects and how they get created from Source objects by the ray-trace functions of Rayica.
Ray versus TurboRays
In this section, we will examine how PropagateSystem and TurboTrace store ray information as either Ray or TurboRays objects. In general, however, the user of Rayica will never work directly with Ray and TurboRays objects. As such, the following discussion is simply provided to help the user gain further insight into how Rayica's handles the ray-trace information. For the most part, these mechanisms are hidden away from the Rayica user. If you are learning about Rayica for the very first time, you can skip this section without penalty.
At the start of a ray-trace, both PropagateSystem and TurboTrace use the CreateRays function to convert Source objects into either Ray or TurboRay objects. This initializes the ray information for the trace.
CreateRays[source, options] is used by PropagateSystem and TurboTrace to generate either Ray objects or a TurboRays object that represents a set of rays for the given light source.
Ray[rules] contains rules that is used by PropagateSystem to characterize a single ray segment of light between two optical surfaces.
TurboRays[{raysegment1, raysegment2, ...}] gives a collection of ray segment parameters for use with TurboTrace.
The Ray and TurboRays objects offer two parallel ways of storing the same information about rays. In particular, the Ray object is used by PropagateSystem to hold ray information, while the TurboRays object is used instead by TurboTrace. As an example, we will use the WedgeOfRays function to generate three rays. First, we will assign the WedgeOfRays result into a variable, called wedgeofrays.
In[20]:=
wedgeofrays = WedgeOfRays[10]
Out[20]=
With InputForm, we can see that, like SingleRay, WedgeOfRays also creates a single Source object. However, this Source object defines a wedge-shaped pattern of three rays.
In[23]:=
wedgeofrays//InputForm
Out[23]//InputForm=
Source[{}, SourceDescription :> SourceDescription[WedgeOfRays[{Ray[]}, 10,
SourceTransformation -> {{0., 0., 0.}, {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}},
SymbolicSourceTransformation -> {{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}]],
SourceTransformation :> {{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}},
SymbolicSourceTransformation :> {{0, 0, 0}, {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}}, SourceLevel :> {1, 1},
NumberOfRays :> 3, BirthPoint :> {0, 0, 0}, CoordinateSystem :> PolarCoordinates, StartAtBirthPoint :> True,
MonteCarlo :> False, SourceID :> 2118, SourceFraction :> 1, SourceOffset :> 0, GridSpacing :> (#1 & ),
PowerOutput :> 100, SymbolicValues :> {}]
Next, we will demonstrate how CreateRays is used by PropagateSystem to initialize the ray information as Ray objects. When we apply CreateRays to wedgeofrays, there are three Ray objects generated.
In[22]:=
CreateRays[wedgeofrays]//InputForm
Out[22]//InputForm=
{Ray[Intensity :> 100., IntensityScale :> 1., OpticalMedium :> Air, Polarization :> {0., 1., 0.},
RayEnd :> {0., 0., 0.}, RayLabelPositions :> {{0., 0., 0.}}, RayLength :> 0., RayLineRGB :> Automatic,
RayPointRGB :> {0., 0., 0.}, RaySourceNumber -> {{1, 3}, {1, 0}}, RayStart :> {0., 0., 0.},
RayTilt :> {0.9961946980917455, 0.08715574274765817, 0.}, RefractiveIndex :> 1.0002694514570802,
RotationMatrix :> {{0.9961946980917455, 0.08715574274765817, 0.}, {-0.08715574274765817, 0.9961946980917455, 0.},
{0., 0., 1.}}, SourceID :> 2118, SourceTransformation :> {{0., 0., 0.}, {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}},
WaveFrontID :> {{2118, 0}}], Ray[Intensity :> 100., IntensityScale :> 1., OpticalMedium :> Air,
Polarization :> {0., 1., 0.}, RayEnd :> {0., 0., 0.}, RayLabelPositions :> {{0., 0., 0.}}, RayLength :> 0.,
RayLineRGB :> Automatic, RayPointRGB :> {0., 0., 0.}, RaySourceNumber -> {{2, 3}, {2, 0}}, RayStart :> {0., 0., 0.},
RayTilt :> {1., 0., 0.}, RefractiveIndex :> 1.0002694514570802,
RotationMatrix :> {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}, SourceID :> 2118,
SourceTransformation :> {{0., 0., 0.}, {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}}, WaveFrontID :> {{2118, 0}}],
Ray[Intensity :> 100., IntensityScale :> 1., OpticalMedium :> Air, Polarization :> {0., 1., 0.},
RayEnd :> {0., 0., 0.}, RayLabelPositions :> {{0., 0., 0.}}, RayLength :> 0., RayLineRGB :> Automatic,
RayPointRGB :> {0., 0., 0.}, RaySourceNumber -> {{3, 3}, {3, 0}}, RayStart :> {0., 0., 0.},
RayTilt :> {0.9961946980917455, -0.08715574274765817, 0.}, RefractiveIndex :> 1.0002694514570802,
RotationMatrix :> {{0.9961946980917455, -0.08715574274765817, 0.}, {0.08715574274765817, 0.9961946980917455, 0.},
{0., 0., 1.}}, SourceID :> 2118, SourceTransformation :> {{0., 0., 0.}, {{1., 0., 0.}, {0., 1., 0.}, {0., 0., 1.}}},
WaveFrontID :> {{2118, 0}}]}
Here, each Ray object represents a different ray segment. When TurboTrace is used for ray-tracing, it works instead with a TurboRays object. The OutputType option is used with CreateRays to determine whether CreateRays generates a Ray object or a TurboRays object from the Source information. By default, CreateRays creates Ray objects. However, when TurboTrace calls CreateRays, it passes OutputType -> TurboRays to obtain a TurboRays object. Next we apply CreateRays to wedgeofrays for a second time with OutputType -> TurboRays.
In[21]:=
CreateRays[wedgeofrays, OutputType -> TurboRays]//InputForm
Out[21]//InputForm=
TurboRays[{{0., 0., 0., 0., 0., 0., 0.9961946980917455, 0.08715574274765817, 0., -0.08715574274765817,
0.9961946980917455, 0., 0., 0., 1., 0.532, 100., 0.33333333333333337, 0., 1.0002694514570802, 0., 0., 0., 0., 0., 0.,
0., 2118., 2118., 1., 3., 1., 0., 1., 0., 0., 0., 1., 0.}, {0., 0., 0., 0., 0., 0., 1., 0., 0., 0., 1., 0., 0., 0.,
1., 0.532, 100., 0.33333333333333337, 0., 1.0002694514570802, 0., 0., 0., 0., 0., 0., 0., 2118., 2118., 2., 3., 2.,
0., 1., 0., 0., 0., 1., 0.}, {0., 0., 0., 0., 0., 0., 0.9961946980917455, -0.08715574274765817, 0.,
0.08715574274765817, 0.9961946980917455, 0., 0., 0., 1., 0.532, 100., 0.33333333333333337, 0., 1.0002694514570802,
0., 0., 0., 0., 0., 0., 0., 2118., 2118., 3., 3., 3., 0., 1., 0., 0., 0., 1., 0.}}]
This time, only a single TurboRays object is produced that contains three sets of numbers. In this case, each set of numbers represents a different ray segment. From this, we can see that TurboRays is much more efficient at holding information than Ray objects! This is gives TurboTrace the ability to work with very large ray-data sets and consume less memory. However, the Ray object is much more flexible at holding different sorts of optical parameters, such as user-defined parameters. This, in turn, gives PropagateSystem added flexibility over TurboTrace for tracing customized information. In general, however, the user of Rayica will never work directly with Ray and TurboRays objects and these conversions happen transparently. In the next section, we will learn about Options[Ray]. Options[Ray]is used by CreateRays to fill in any essential ray parameters missing from the specified Source object during its ray creation.
How Rayica manages default light source settings
In Rayica as well as Mathematica, most built-in functions have a way to pass default settings about certain parameters. This relieves the user from always having to specify all possible parameters required by the function to operate. Such default parameters are referred to as "options" because you can optionally decide to change the setting of such a parameter (but you don't have too!) As you will see shortly, each option follows the pattern: optionlabel -> optionvalue. (Such a pattern is also called a "rule" because it is internally evaluated by Mathematica as: Rule[optionlabel, optionvalue].) As with all other types of Rayica's light source functions, SingleRay[] has many options that help describe the generated ray.
Since all types of light sources must make the same basic assumptions about their created rays, Rayica uses a single location, called Options[Ray], to store this information. The most important of these settings include physical attributes, such as: wavelength, polarization, intensity, and optical length. However, there are also a number of other non-physical attributes as well. You can check these default assumptions by examining the contents of Options[Ray].
In[4]:=
Options[Ray]
Out[4]=
Options[Ray] applies to all of Rayica's light sources since it determines what default values will be used by the rays at the start of the trace. In some cases, a parameter many not have a specific initial setting. In such cases, the optionvalue is given the same name as the optionlabel. In other cases, the optionvalue can simply be written as Automatic. In such a case, the option value is dynamically assigned. Regardless of its setting, every possible option parameter is listed in Options for the benefit of the user to know either that it exists or that it can be altered with a user-specified value.
In order to specify a new ray parameter setting, you simply pass the changed option setting as a parameter. For example, to change the wavelength setting to 0.633 microns, you would use:
In[15]:=
SingleRay[WaveLength -> .633]
Out[15]=
In this case, a subsequent ray-trace would use this new wavelength setting. In addition, SingleRay also has its own set of options that specifically applies to only the SingleRay function. These are found in Options[SingleRay]:
In[3]:=
Options[SingleRay]
Out[3]=
In the same manner as SingleRay, all other built-in light source functions also have their own specific option settings that are accessed with their function name, given by Options[function name]. In fact, a good way to learn more about any unfamiliar function in Rayica (or Mathematica) is to have a look at its built-in options because this often gives you a clue about the range of behaviors that the function can exhibit. You can learn more about Rayica's built-in light source functions in
of the Principles of Rayica Guide.
Modeling an optical component
Rayica has many more functions for modelling optical components than it has for light sources. In fact, there are presently 122 component functions in common use. At any time that you wish while working with Rayica, you can access a listing of the component functions with the ComponentFunctions command:
In[9]:=
ComponentFunctions