NSC Angle of Incidence from Ray Database Viewer

This article shows the steps for calculating the AOI based on the LMN direction cosine of a ray and the Normal vector of the surface at the intersection point.  There is a provided ZPL macro will will automatically calculate this information for the user from a ZRD file loaded in a Ray Database Viewer.
Michael Humphreys
02/14/2017
Non Sequential Ray Tracing
ZPL

 
 

OpticStudio provides a lot of useful information in a Ray Database Viewer.  All of this information is considered to be the “base” information and there is some useful information that a user might have to derive from this base information.  The information reported is:
  • Segment identification and history (left 6 columns)
  • Interaction at a given surface (XRTSDGEFBZ columns)
  • XYZ ray intercept coordinates
  • LMN direction cosines
  • Nx/Ny/Nz surface normal at the ray intercept
  • Real & Imaginary E-field
  • Path & Phase information
A lot of users might want to visualize the LMN and Normals in terms of Angle of Incidence rather than the provided vector representation.  To get this information, you will need to use the equation for the angle between 2 vectors:
 

 
Translating this to OpticStudio values, you get the angle to be:
 

 
In order to automate this process, you can create a ZPL macro that will loop through each row in an opened Ray Database Viewer (the RDV needs to be opened to ensure that the proper LMN and Normal values are displayed since these can be toggled on & off).  The attached ZPL will ask the user for the window number of the RDV, which is the number in the left part of the tab. The only 2 caveats for using this macro are:
  1. Both the LMN and Normal boxes must be checked
  2. Only 4 out of the bottom 5 boxes can be checked 


The following will be the output.  Notice that the LMN and Normal components are printed out so you can verify that the inputs are correct.  The last column will be the AOI of the ray with respect to the surface normal.