RAYTRACE
Calls the OpticStudio ray tracing routines to trace a particular ray through the current system.
Syntax:
RAYTRACE hx, hy, px, py, wavelength
Discussion:
The expressions hx and hy must evaluate to values between -1 and 1, and represent the normalized field coordinates. The pupil coordinates are specified by the expressions px and py, which also must be between -1 and 1. For more information about normalized coordinates see "Normalized field coordinates". 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.
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). 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 returns a value of -9999, the ray cannot be launched.
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 OPDC returns the optical path difference 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:
PRINT "Tracing the marginal ray at primary wavelength!" n = NSUR() RAYTRACE 0,0,0,1 y = RAYY(n) PRINT "The ray intercept is ", y PRINT "Tracing the chief ray at maximum wavelength!" RAYTRACE 0,1,0,0,NWAV() y = RAYY(n) PRINT "The ray intercept is ", y
Related Keywords:
RAYTRACEX
Next: