2. Placement Directives

2.1 Overview

Coordinate systems in Rayica fall into two categories, local and global.  Every component and light  source has a local coordinate system.  Rayica defines the component geometry in this local system.  In turn, the  overall optical system has a global reference frame.  Component placement  happens in this context.  Such placement is achieved by the Move function and its variants.  Refer to these functions as placement  directives.

Rayica works with standard Euclidian coordinates.  However Rayica's default optic axis is the x-axis.  This convention is not universal; many textbooks adopt z as the optic axis, with x-y as the focal plane.  The reason for this convention in Rayica is that it meshes better with various default settings in Mathematica graphics.  Of course, Rayica has full three-dimensional generality.  You are free to orient your  system in any manner whatsoever.  Saying that Rayica has a default axis means that built-in components use x as their local optic axis.  Thus if you wanted z as your system's optic axis, you would have to rotate every component 90  degrees.

Mathematica represents vectors as lists {x,y,z}, and matrices as nested lists {{a,b},{c,d}}.  Two-dimensional vectors have two elements {x,y}, and three-dimensional vectors have three.  Mathematica makes no distinction between row and column vectors.  Rayica maintains these conventions of the Mathematica language.  For placement purposes, Rayica uses direction vectors as well as position vectors.  Direction vectors specify orientation.  Scalar angles are also used.

When you invoke a component or light source, Rayica drops it into your system with the local coordinate axes coincident with  the global axes.  If a Move-related function wraps the component invocation, Rayica performs the indicated maneuver.  Specifically, Rayica defines component position as the location of the component's local  coordinate origin relative to the global origin.  Component orientation,  meanwhile, is considered between the component's local coordinate axes and  the global coordinate axes.  So for purposes of placing components, you  should visualize placement directives manipulating local coordinate axes.   The physical component, with its surfaces and properties, just goes along for  the ride.

Placement directives are general across all types of objects.  These  functions work on components, light sources, and rays.  You can, for example,  apply MoveReflected to a prism, even though it is not a mirror.  The geometry of any  placement directive is completely general.  However, some of them, like MoveReflected, are designed with particular components in mind.  Placement directives  also work on optical systems, that is, lists of components and sources.

Placement directives may be nested.  There is no requirement to achieve a given placement with a single function call.  Use as many nested directives as seems reasonable.  While it is best to minimize the nesting of directives, in some situations this type of input is unavoidable.

2.2 Placing Components and Systems

Placement refers to the positioning of a component or light source in  global system coordinates.  It may also involve an adjustment of the object's  orientation, depending on the function used.  Rayica features several placement directives that affect orientation as well as  position; these functions offer convenient ways to set up optical systems.

There are usually several different ways to achieve the same placement.   Sometimes Rayica echoes back a different function than was supplied as input.  This  behavior is not an error.  Rayica uses the echo-back string to express an equivalent formulation which Rayica stores internally.

Rayica presents a small toolbox of placement directives.  The primary functions  are Translate, Rotate, Move, MoveLinear, MoveDirected, MoveReflected, and MoveAligned.  By far the most commonly used function is Move.  In fact, different calling conventions for Move can essentially perform all the other functions.  Yet at its simplest  level, Move simply translates components without changing orientation.  The other  functions have more specialized applications.  Translate and Rotate perform their eponymous functions in one, two, or three dimensions.  In  general, all positioning functions work in any dimension; the dimensionality  in a given case follows the supplied input parameters.

Rayica supports a few directives that handle orientation automatically.  MoveLinear and MoveDirected both drive components along an optical rail and orient them with the rail  direction.  The difference between them lies in their parameter formats.  MoveLinear uses a scalar distance along the rail to find absolute position, whereas  MoveDirected accepts absolute position directly (the scalar distance being implicit).  MoveReflected positions and orients a mirror by consideration of reflective geometry.  This function simplifies the redirection of light beams in your system.  Later on, in Section 2.4, we will examine the advanced MoveAligned function that calculates optical element positions with a chief ray trace through the system.

2.2.1 Legacy Issues

Some of the functions discussed in this chapter may be called with a 3D appendage, for example Move3D instead of Move.  These 3D functions were more important in previous versions of Rayica.  They are still available, but somewhat obsolete.  All positioning  directives now work in three dimensions without the 3D appendage.

Some of the directives worked a little differently in older versions of Rayica.  For purposes of backward compatibility, Move has an option that reverts its behavior to conform with previous  versions.  See the Help Browser for details.  This option should be used only  to support legacy Rayica code.

2.2.2 Translate

This function is the simplest positioning command.  Invoke Translate with a translation vector of one, two, or three dimensions.  For example,  here is a group of three lenses translated by vectors of different  dimensions.

In[4]:=

Translate works in one, two, and three dimensions.

The one-dimensional version works equally well sans vector notation.  So  instead of Translate[lens1,{50}], you could enter Translate[lens1,50] without the curly braces.  The two- and three-dimensional versions do  require vector notation.

Translate does not affect orientation.  If you need to place a component with a  certain orientation, it is possible to combine Translate with Rotate, but you may wish to employ a different function having unified  capability.  Rarely in Rayica will you need to perform manually computed rotations.

2.2.3 Move

Move is the most general component placement function.  It may be called in  many different ways to accomplish different placements.  A primary purpose of  Move is simple translational motion.  The translation can be one-, two-, or  three-dimensional.  All three cases are illustrated below in both plan and  elevation views.

In[9]:=

Move can perform the same operations as Translate.

As with Translate, the one-dimensional case works with or without vector notation (curly  braces); higher dimensions require vector notation.

Move is more general than Translate in that it can also change orientation.  This capability of Move is described later.  You might employ Translate instead of Move for purely translational cases; such a convention might improve code  readability.

2.2.4 MoveLinear

The MoveLinear function simulates a notched optical rail.  The function parameters  include two points defining the rail's axis, plus a scalar value giving the  component's distance along this axis.  The function automatically aligns the  component with the axis.

In[41]:=

MoveLinear simulates an optical rail having an axis ab.

The first lens is 50 units distant from point a.  The second lens is 100 units distant from a.  The orientation of each lens is colinear with axis ab.

Note the use of Epilog to add custom graphics to the Rayica output.  Epilog is a standard Mathematica graphics option.  Sometimes the production of pleasing graphics requires  a certain amount of experimentation when dealing with Mathematica's graphics primitives.  Do not recompute your optical system with each  experimental iteration.  Instead, compute the system once, assigning the  result into a variable (like sys above). Then use ShowSystem with the variable and different settings of Epilog until you have a satisfactory display.

2.2.5 MoveDirected

MoveDirected is a close cousin of MoveLinear.  MoveDirected performs the same task with different inputs.  It also accepts two  points, but the second point directly assigns the component position.  With  this function, there is no need to specify scalar distance along the rail.   The two points suffice because one of them establishes absolute position, not  merely linear direction.

In[46]:=

MoveDirected puts components and sources at a point and orients them toward a second  point.

The light source position is c, oriented toward a.  The lens position is a, oriented toward b.

The SideOfObject option applies only to MoveDirected.  This option specifies which side of the component or light source is  taken by the first input point, and this assigns the orientation of the  component or light source.  In the case of light sources, the first input  point is usually located on the positive side of the source's local optical  axis, and After is specified for SideOfObject.  In the case of optical components, the first input point is usually  located on the negative side of the component's local optical axis so that Before is used. The net effect of SideOfObject is a 180 degree flip in the orientation of the object.

2.2.6 MoveReflected

The idea of MoveReflected is to angle a mirror according to incident and reflected beams.  The  function accepts three distinct points a, b, and c.  Point b gives the absolute position of the mirror.  This position is independent  of the mirror's orientation.  The orientation arises from consideration of  all three points.  The following diagram clarifies the geometry involved.   This is a two-dimensional example and therefore the points are defined in two  dimensions.  The function also works in three dimensions.

In[128]:=

The geometry of MoveReflected in two dimensions.

The line bd bisects angle abc.  MoveReflected[mirror, a, b, c] positions the mirror at b, and orients its normal vector along bd.  Effectively this function orients the mirror to receive light from the  direction of a and reflect it in the direction of c from the vantage of position b.  MoveReflected assumes that bisection of the angle abc will produce a reasonable orientation angle for this purpose.  The  mirror's normal vector will always bisect angle abc.

In three dimensions, lines ab and bc determine a plane.  The mirror's normal vector will lie in the same plane  such that it bisects the angle abc that is formed in this plane.

2.3 Angular Orientation

Some of the Move-related functions that have been presented incorporate their own angular  effects.  If none of these satisfies your requirements, you can orient  components directly.

Rayica uses three basic mechanisms to implement rotations:  direction vectors,  rotation angles, and twist angles.  There exist other means as well; these  are only the most common.  You may also define angular orientations by means  of fully general 3-by-3 rotation matrices, for example.

2.3.1 Move with Intrinsic Rotation

The Move function not only performs translation, but it can also change component  orientation at your option.  Move offers several ways to define orientation.

In three dimensions, you will typically define a tilt vector and a twist angle. The twist angle is optional. The tilt vector specifies the direction in  which the component faces. The following visualization shows how this method  works.  Each display shows two lenses: one lens occupies the default  placement at the origin; the other lens some specific placement indicated by  input parameters shown above the graphic.

How the tilt vector and twist angle work in three dimensions.  Plot labels  show what input to Move generated the graphic.

In all four cases, the second lens sits at position {100,50,50}.  The graphic at top-left shows simple translation to this position.   There is no tilt vector, so there is no change in orientation.  At the  top-right, the extra tilt vector parameter causes orientation to align in its  direction.  The lower two graphics show how twist angles work.  At the  bottom-left, the tilt vector points in the opposite direction, and the lens  twists about the line of its direction vector by 45 degrees.  The tilt  vectors are different in all four cases.  At the bottom-right, a completely  general tilt vector shows the flexibility of this type of input.

In two dimensions, you will less often use a direction vector although you  still can, using zero for its z component.  The reason is that two-dimensional attitude finds simpler  expression as a rotation in the plane.  Therefore, Rayica lets you input a rotation angle to express rotation about the z-axis.  This angle is distinguished from the twist angle, which is about  the x-axis (the optic axis).  The following visualization demonstrates how  these parameters work.

Rotation and twist angles with two-dimensional displacement.  Plot labels  show what input to Move generated the graphic.

The top-left graphic shows one-dimensional translation with Move.  The top-right graphic shows two-dimensional translation.  Both cases  omit orientation parameters, which are optional.  The bottom-left graphic  shows how rotation angle works.  The component rotates 45 degrees about its  local z-axis.  The bottom-right graphic takes matters a step further, adding to  this initial rotation a twist angle of 45 degrees.

In rare cases, you may wish to supply your own rotation matrix to Move.  The function pattern for this type of call is Move[object,{x,y,z},R] where R is a 3 x 3 rotation matrix.  Generally under these circumstances you will  prefer to use Rotate.

2.3.2 Rotate

The Rotate function performs general rotations.  Rotate can use a 3 x 3 rotation matrix of your design, but is even more general,  for it can rotate objects about an arbitrary axis. A 3 x 3 transformation can  only rotate about an axis through the origin. Such rotations happen when  mechanical alignment issues prevent exact placement of components at some  rotation center.

The primary calling pattern accepts three parameters:  angle of rotation,  axis direction vector, and axis center position. The angle specifies the  amount of rotation.  The direction and center define a line in space that is  the axis of rotation. The center is a point on the line, while the direction  fixes its attitude.  When omitted, these parameters adopt default values of  {1,0,0} for the direction vector and {0,0,0} for the center.  This default is a vertical line through the origin.

The figure below shows how the defaults operate.

Various capabilities of Rotate.

The progression is as follows.  At the top-left, only the rotation angle  is supplied.  At the top-right, a different axis of rotation is used with the  same angle.  At the bottom-left, the same axis is used but at a different  center.  The mirror slides along a radial arc with the center of curvature at  {12,0,0}.  Visualize the arc on the base of the plot, right below the mirrors.  At  the bottom-right, a different case altogether shows the general capabilities  of Rotate.

Yet another way to invoke the Rotate function exists.  Rotate can employ tilt vectors in a manner identical to Move.  (See the Help Browser for details.)  You may prefer Rotate as a more descriptive name than Move in those cases involving angular orientation only.

This section presents a useful advanced function that generalizes MoveLinear.  Instead of following a linear rail, MoveAligned follows an arbitrary light path through space.  Only component spacings  are specified.  MoveAligned places each component at a given spacing along the light path determined  by the preceding component.  This function invokes PropagateSystem internally to find the light path.

Here is a simple example of MoveAligned.  The prism bends the light path, but MoveAligned follows it.  The lens and screen are centered on the beam.

In[36]:=

The custom MoveAligned function lets you place components by defining their spacing along the  light path of the system.

We define only the spacing between components along the light path.  A three-dimensional example is more dramatic.

In[13]:=

Out[18]=

MoveAligned in three dimensions.

It would have been difficult to devise equivalent Move directives for this optical system.  The MoveAligned function computes them automatically using an internal scout trace.  MoveAligned also works well for laser resonator layout.  This is demonstrated further  in Section 4.2.3.

Created by Mathematica  (November 19, 2004)