RAYTRACEX
Calls the OpticStudio ray tracing routines to trace a particular ray from any starting surface through the current system.
Syntax:
RAYTRACEX x, y, z, l, m, n, surf, wavelength
Discussion:
The expressions x, y, z, l, m, and n define the input ray position and direction cosines in the local coordinates of the starting surface. The surface expression must evaluate to an integer between 0 and the number of surfaces minus one, inclusive. The wavelength expression is optional, defaulting to the primary wavelength, but if supplied must evaluate to an integer between 1 and the maximum number of defined wavelengths.
If the object has a thickness of infinity, and the surf parameter is zero, then the input coordinates are assumed to be relative to the first surface rather than the object surface; although the ray will still be defined in object space media. Otherwise, OpticStudio uses the specified coordinates without alteration.
Once the ray is traced, the ray intercept coordinates and direction cosines may be determined using the ZPL functions RAYX, RAYY, RAYZ, RAYL, RAYM, and RAYN (use RAGX, RAGY, RAGZ, RAGL, RAGM, and RAGN to get results in global coordinates). Note only data from surface AFTER the "surf" surface will be valid.
If an error occurred during ray tracing, the function RAYE (for RAY Error) will return a value other than zero. If RAYE is negative, it indicates that total internal reflection occurred at the surface whose number is the absolute value of the value returned. If RAYE is greater than zero, then the ray missed the surface number returned.
Checking RAYE is optional, however, the RAYX, RAYY, ... functions may return invalid data if RAYE is not zero. The functions RANX, RANY, and RANZ return the intercept surface normal direction cosines, and RAYT returns the optical path length up to the surface for the ray. The function RAYV returns the surface number at which the ray was vignetted, or it returns zero if the ray was not vignetted. Values returned for surfaces past the surface of vignetting may not be accurate.
Example:
n = NSUR() RAYTRACEX 0,1,0,0,0,1,0,NWAV() y = RAYY(n) PRINT "The ray intercept is ", y
Related Keywords:
RAYTRACE
Next: