ZEMAX Users' Knowledge Base - http://www.zemax.com/kb
How to Work in Global Coordinates in a Sequential Optical System
http://www.zemax.com/kb/articles/194/1/How-to-Work-in-Global-Coordinates-in-a-Sequential-Optical-System/Page1.html
By Mark Nicholson
Published on 22 June 2007
 

When working with a sequential optical system, it is usually most convenient to work in local coordinates. However, there are cases when working in global coordinates is easier: typically when working with perturbation data produced by FEA in systems with complex 3-D tilts and decenters. This article describes how to switch between sequential and global data entry methods.


Introduction
When working with a sequential optical system, we usually work in local coordinates, in which one surface is located a "thickness" in z away from the previous surface. Coordinate break surfaces provide decentrations in x and y, as well as tilts in x, y and z. A set of Tools under the Coordinates menu provide easy access to tools intended to simplify common tasks like adding or removing fold mirrors, or tilting/decentering components and groups of components:



Sometimes, it is more convenient to work in a global coordinate system. A common example is when an optical system has been transferred to a Finite Element Analysis (FEA) package to undertake vibration analysis. This is routinely performed with optical designs ranging from consumer electronics like digital cameras, to space-borne telescopes and satellite imaging lenses. Ultimately, a set of vibration-induced perturbations is produced, and these must be imported into ZEMAX to evaluate the optical impact of the mechanical shifts.

In this case, it is convenient to shift between local and global coordinates in either direction easily and quickly. This article describes how the Global/Local and Local/Global tools in the above menu work. 

The Starting Design
Let's start by designing an optical system complex enough to be worthwhile for this kind of work, but simple enough to clearly demonstrate the principles. The last page of this article has a link to a zip file that contains the starting point of the design we will work on: single_prism.zmx:



Before proceeding, it is worth spending some time looking at how this file is set up.



Collimated light enters the system at surface 1. Surface 2 is a flat surface, with a rectangular aperture on it:



This surface is also tilted by 15 degrees with respect to the coordinate system established by surface 1. After the surface, we 'untilt' by -15 degrees so that subsequent surfaces lie in the original coordinate system:



In the jargon of 3-dimensional geometry, we have 'restored the original coordinate system'. Surface 3 is also tilted, this time by -15 degrees:



Another very useful control in setting up 3-D geometries is the ability to draw the local axis of each surface in the system. This is turned on surface-by-surface using the control in the Draw tab:



With this turned on for every surface, the 3-D layout shows:



Surface 1 (drawn in red) is the Global Coordinate Reference Surface and defines the starting coordinate system of the system. The arrow protruding from the surface is its local z, the red line moving straight up the page is its local y, and the local x is pointing into the screen and cannot be seen.

Surface 2 shows its +15 degree x-tilt, and surface 3 shows its -15 degree tilt.

Next, notice that surface 4 is a coordinate break surface, and scrolling the editor to look at the decenter x, y and tilt x, y parameters. Note that these are all controlled by chief-ray-follow solves:



Chief-ray-follow solves decenter of tilt the coordinate system such that the coordinate system is normal to and centered on the chief ray. Basically, it ensures that the following surface is centered on the optical beam:



This shows one of the key advantages of the local coordinate system. Because the local coordinate system 'follows the surfaces' it is easy to change on a surface-by-surface basis as the light propagates through the system. ZEMAX contains many ray-based solves to enforce common requirements, and ZPL-macro based solves can also be defined for more specific requirements.

However, we will now go on to extend this sample file in a way in which the local coordinate system is not so helpful, and see how to switch easily between local and global coordinate systems.

Extending the Starting Design

Click on surface 2 of the Lens Data Editor, press the left mouse button, and hold it down while you drag over surfaces 3 and 4. Surfaces 2, 3 and 4 are all highlighted in the editor:



Alternatively, click on surface 2, and use <Shift> and the <down cursor key> to highlight the rows. Then press <Cntl>C, or click on Edit...Copy Surfaces on the editor menu bar to copy these surfaces to the Windows Clipboard.

Then, click on surface 5 and press <Cntl>V or Edit...Paste. Do this a total of 10 times, to paste 10 copies of the prism assembly into the editor. The layout window will update to show:



So we now have a chain of prisms that brings the beam though approximately 180°. Easy!

The Lens Data Editor now contains 35 surfaces. We will choose the prism formed by surfaces 17 and 18 as the 'target' prism for our perturbational analysis. In the Lens Data Editor menu bar, choose View...Go To Surface and go to surface 17:




For both surface 17 and 18, set the surface comment to be "My Prism" and set the surface color to be color 4, for easier identification on the Shaded Model layout:




Now, let us imagine that our task is to perturb the position of the target prism. If we work in local coordinates, that is easy. We just use Tools...Coordinates...Tilt/Decenter Elements, choose the surfaces we want to perturb and enter the perturbation values directly:



But, if the perturbations are computed relative to some other position in the optical system, this is not so straightforward using the local coordinate system. In this case, entering data in global coordinates is preferable. It is a simple matter to convert to global coordinates, and back to local coordinates, as required.


Converting to Global Coordinates
Under the Tools...Coordinates menu there are two items, Global/Local and Local/Global:



Surface 1 is currently set as the Global Coordinate Reference Surface, so it makes sense to position all surfaces relative to this one. Note that this is not required: we can position using any surface prior to the range we are converting. But, it is convenient to have a single 'global' reference!

Set it up like so:



And note that the Lens Data Editor now contains three Coordinate Break surfaces per prism. Here is our target prism:



The first Coordinate Break uses Coordinate Return solves to shift back to the position of the reference surface. The second provides decenters in x, y and z (the thickness parameter), and the third provides tilts in x, y, and z. Therefore, relative to surface 1, surface 27 (the front face of the target prism) is at

x = 0.0
y = -162.03
z = 191.384
Tilt_x = 83.007
Tilt_y = 0.0
Tilt_z = 0.0


This data can be read directly from the second and third Coordinate Break data. Even better, lets say we now want to change the position of this prism to:

x = 0.5
y = -164
z = 198
Tilt_x = 84
Tilt_y = -2.3
Tilt_z = 4.7


Just enter this data into the two Coord Break surfaces (put x, y, z data into the decenter x, decenter y and thickness parameters of the second CB, and the tilt data into the tilt parameters of the third CB) and the prism is automatically positioned correctly. Note that the following prisms do not shift position: we are positioning our target prism directly in global coordinates, and its position or orientation does not affect the position or orientation of any other object.



Better still, just do Tools...Coordinates...Global/Local and the system is automatically recast into local coordinates!

ZEMAX supports useful shortcuts to enter perturbational data into the editor. Just enter a plus sign and then the increment, then Enter. For example, to change a 12 to 17, type "+5" and Enter.

The "*" multiply and "/" divide symbols also work. To subtract a value,  type a minus sign and a space followed by the value to subtract. The space is required to distinguish between subtraction and entering a negative number. Alternatively enter +-5 to avoid ambiguity.

Note one frequently made mistake: the ray-tracing is still sequential, so if our target prism is moved away from the beam altogether, ray-tracing stops:



In sequential mode, if rays cannot trace to the next surface the ray-trace terminates. To allow one prism to be taken out of the beam, and for the beam to just continue tracing to the next prism, is a task that non-sequential ray tracing is needed for. The file should be converted to a non-sequential ZEMAX model in this case.

Summary
The Local/Global and Global/Local tools under the Coordinates menu item provide simple and fast switching between data entry in local and global coordinate systems.