ZOSAPI.Tools.RayTrace.IBatchRayTrace Interface Reference
Last update: 17.07.2025Interfaces and methods for running a ray trace on multiple rays at a time. This interface can be accessed via the IOpticalSystemTools interface. More...

Public Member Functions | |
| IRayTraceNormUnpolData | CreateNormUnpol (int MaxRays, RaysType rayType, int toSurface) |
| Performs a batch unpolarized ray trace, using normalized pupil coordinates. See the OpticStudio help manual for more information. | |
| bool | SingleRayNormUnpol (RaysType rayType, int toSurf, int waveNumber, double Hx, double Hy, double Px, double Py, bool calcOPD, out int ErrorCode, out int vignetteCode, out double xo, out double yo, out double zo, out double lo, out double mo, out double no, out double l2o, out double m2o, out double n2o, out double opd, out double intensity) |
| Performs the same calculation as CreateNormUnpol, but for one ray at a time. | |
| IRayTraceDirectUnpolData | CreateDirectUnpol (int MaxRays, RaysType rayType, int startSurface, int toSurface) |
| Performs a batch unpolarized ray trace, using direct x/y/z coordinates. See the OpticStudio help manual for more information. | |
| bool | SingleRayDirectUnpol (RaysType rayType, int startSurface, int toSurface, int waveNumber, double X, double Y, double Z, double L, double M, double N, out int ErrorCode, out int vignetteCode, out double xo, out double yo, out double zo, out double lo, out double mo, out double no, out double l2o, out double m2o, out double n2o, out double intensity) |
| Performs the same calculation as CreateDirectUnpol, but for one ray at a time. | |
| IRayTraceNormPolData | CreateNormPol (int MaxRays, RaysType rayType, double Ex, double Ey, double phaX, double phaY, int toSurface) |
| Performs a batch polarized ray trace, using normalized pupil coordinates. See the OpticStudio help manual for more information. | |
| bool | SingleRayNormPol (RaysType rayType, double Ex, double Ey, double phaX, double phaY, int toSurf, int waveNumber, double Hx, double Hy, double Px, double Py, double exr, double exi, double eyr, double eyi, double ezr, double ezi, out int ErrorCode, out double exro, out double exio, out double eyro, out double eyio, out double ezro, out double ezio, out double intensity) |
| Performs the same calculation as CreateNormPol, but for one ray at a time. | |
| bool | SingleRayNormPolFull (RaysType rayType, double Ex, double Ey, double phaX, double phaY, int toSurf, int waveNumber, double Hx, double Hy, double Px, double Py, double exr, double exi, double eyr, double eyi, double ezr, double ezi, out int ErrorCode, out double xo, out double yo, out double zo, out double lo, out double mo, out double no, out double exro, out double exio, out double eyro, out double eyio, out double ezro, out double ezio, out double intensity) |
| Performs the same calculation as CreateNormPol, but for one ray at a time. | |
| IRayTraceDirectPolData | CreateDirectPol (int MaxRays, RaysType rayType, double Ex, double Ey, double phax, double phay, int startSurface, int toSurface) |
| Performs a batch polarized ray trace, using direct x/y/z coordinates. See the OpticStudio help manual for more information. | |
| bool | SingleRayDirectPol (RaysType rayType, double Ex, double Ey, double phaX, double phaY, int startSurface, int toSurface, int waveNumber, double X, double Y, double Z, double L, double M, double N, out int ErrorCode, out int vignetteCode, out double exro, out double exio, out double eyro, out double eyio, out double ezro, out double ezio, out double intensity) |
| Performs the same calculation as CreateDirectPol, but for one ray at a time. | |
| bool | SingleRayDirectPolFull (RaysType rayType, double Ex, double Ey, double phaX, double phaY, int startSurface, int toSurface, int waveNumber, double X, double Y, double Z, double L, double M, double N, out int ErrorCode, out int vignetteCode, out double xo, out double yo, out double zo, out double lo, out double mo, out double no, out double exro, out double exio, out double eyro, out double eyio, out double ezro, out double ezio, out double intensity) |
| Performs the same calculation as CreateDirectPol, but for one ray at a time. | |
| IRayTraceNSCData | CreateNSC (int MaxRays, int maxSegments, double coherenceLength) |
| Creates a interface to define custom non-sequential rays. | |
| IRayTraceNSCSourceData | CreateNSCSourceData (int maxSegments, double coherenceLength) |
| bool | GetDirectFieldCoordinates (int waveNumber, RaysType rayType, double Hx, double Hy, double Px, double Py, out double X, out double Y, out double Z, out double L, out double M, out double N) |
| Convert from Normalized pupil coordinates to X/Y/Z coordinates. | |
| void | GetPhase (double L, double M, double N, double jx, double jy, double xPhaseDeg, double yPhaseDeg, double intensity, out double exr, out double exi, out double eyr, out double eyi, out double ezr, out double ezi) |
Public Member Functions inherited from ZOSAPI.Tools.ISystemTool | |
| bool | Run () |
| Start the tool. Note that for synchronous tools (see IsAsynchronous), this call will block until completion. If it is asynchronous it will start running but return immediately. | |
| bool | RunAndWaitForCompletion () |
| Sames as calling Run followed by WaitForCompletion. | |
| bool | WaitForCompletion () |
| Waits for the asynchronous tool to complete. | |
| bool | Cancel () |
| Cancels the currently running asynchronous tool. | |
| bool | Close () |
| Closes this tool and frees up and associated resources. | |
| RunStatus | WaitWithTimeout (double timeOutSeconds) |
| Waits for the currently running tool to complete, with a specified time out value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. Also note that this method will not start the tool running if it is not already. | |
| RunStatus | RunAndWaitWithTimeout (double timeOutSeconds) |
| Starts the tool running, and waits for it to complete with the specified timeout value. Note that if the timeout is exceeded this method will return, however the tool will continue to run. | |
Additional Inherited Members | |
Properties inherited from ZOSAPI.Tools.ISystemTool | |
| int | Progress [get] |
| Gets the progress of the current tool, if supported. | |
| string | Status [get] |
| Gets the status of the current tool, if supporoted. | |
| bool | IsRunning [get] |
| Gets a value indicating whether the tool is currently running asynchronously. | |
| bool | CanCancel [get] |
| Gets a value indicating whether the tool can be cancelled. | |
| bool | IsAsynchronous [get] |
| Gets a value indicating whether the tool runs asynchronously (i.e. on a thread). | |
| bool | IsFiniteDuration [get] |
| Gets a value indicating whether this tool will complete on its own. | |
| bool | IsValid [get] |
| Gets a value indicating whether the input settings are valid. | |
| bool | Succeeded [get] |
| Gets a value indicating whether the tool execution succeeded. | |
| string | ErrorMessage [get] |
If Succeeded is false, get the error messages; otherwise, null. | |
Detailed Description
Interfaces and methods for running a ray trace on multiple rays at a time. This interface can be accessed via the IOpticalSystemTools interface.
Usage (see Example 22 for a full sample)
C#
C++
Matlab
Python
Member Function Documentation
◆ CreateDirectPol()
| IRayTraceDirectPolData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateDirectPol | ( | int | MaxRays, |
| RaysType | rayType, | ||
| double | Ex, | ||
| double | Ey, | ||
| double | phax, | ||
| double | phay, | ||
| int | startSurface, | ||
| int | toSurface | ||
| ) |
Performs a batch polarized ray trace, using direct x/y/z coordinates. See the OpticStudio help manual for more information.
- Parameters
-
MaxRays The maximum rays. rayType Type of the ray. Ex ex. Ey ey. phax phase x. phay phase y. startSurface The start surface. toSurface To surface.
- Returns
◆ CreateDirectUnpol()
| IRayTraceDirectUnpolData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateDirectUnpol | ( | int | MaxRays, |
| RaysType | rayType, | ||
| int | startSurface, | ||
| int | toSurface | ||
| ) |
Performs a batch unpolarized ray trace, using direct x/y/z coordinates. See the OpticStudio help manual for more information.
- Parameters
-
MaxRays The maximum rays. rayType Type of the ray. startSurface The start surface. toSurface To surface.
- Returns
◆ CreateNormPol()
| IRayTraceNormPolData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateNormPol | ( | int | MaxRays, |
| RaysType | rayType, | ||
| double | Ex, | ||
| double | Ey, | ||
| double | phaX, | ||
| double | phaY, | ||
| int | toSurface | ||
| ) |
Performs a batch polarized ray trace, using normalized pupil coordinates. See the OpticStudio help manual for more information.
- Parameters
-
MaxRays The maximum rays. rayType Type of the ray. Ex ex. Ey ey. phaX phase x. phaY phase y. toSurface To surface.
- Returns
◆ CreateNormUnpol()
| IRayTraceNormUnpolData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateNormUnpol | ( | int | MaxRays, |
| RaysType | rayType, | ||
| int | toSurface | ||
| ) |
Performs a batch unpolarized ray trace, using normalized pupil coordinates. See the OpticStudio help manual for more information.
Usage (see Example 23 for a full sample)
C#
C++
Matlab
Python
- Parameters
-
MaxRays The maximum rays. rayType Type of the ray. toSurface To surface.
- Returns
◆ CreateNSC()
| IRayTraceNSCData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateNSC | ( | int | MaxRays, |
| int | maxSegments, | ||
| double | coherenceLength | ||
| ) |
Creates a interface to define custom non-sequential rays.
- Parameters
-
MaxRays The maximum rays. maxSegments The maximum segments. coherenceLength The coherence length to use if performing a polarized ray trace.
If set to 0, the same coherence value will be used for all rays. Any other value will result in a random coherence value for each ray (for more information, see the OpticStudio documentation regarding Coherence Length).
- Returns
◆ CreateNSCSourceData()
| IRayTraceNSCSourceData ZOSAPI.Tools.RayTrace.IBatchRayTrace.CreateNSCSourceData | ( | int | maxSegments, |
| double | coherenceLength | ||
| ) |
◆ GetDirectFieldCoordinates()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.GetDirectFieldCoordinates | ( | int | waveNumber, |
| RaysType | rayType, | ||
| double | Hx, | ||
| double | Hy, | ||
| double | Px, | ||
| double | Py, | ||
| out double | X, | ||
| out double | Y, | ||
| out double | Z, | ||
| out double | L, | ||
| out double | M, | ||
| out double | N | ||
| ) |
Convert from Normalized pupil coordinates to X/Y/Z coordinates.
- Parameters
-
waveNumber The wave number. rayType Type of the ray. Hx hx. Hy hy. Px px. Py py. X x. Y y. Z z. L l. M m. N n.
- Returns
◆ GetPhase()
| void ZOSAPI.Tools.RayTrace.IBatchRayTrace.GetPhase | ( | double | L, |
| double | M, | ||
| double | N, | ||
| double | jx, | ||
| double | jy, | ||
| double | xPhaseDeg, | ||
| double | yPhaseDeg, | ||
| double | intensity, | ||
| out double | exr, | ||
| out double | exi, | ||
| out double | eyr, | ||
| out double | eyi, | ||
| out double | ezr, | ||
| out double | ezi | ||
| ) |
◆ SingleRayDirectPol()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayDirectPol | ( | RaysType | rayType, |
| double | Ex, | ||
| double | Ey, | ||
| double | phaX, | ||
| double | phaY, | ||
| int | startSurface, | ||
| int | toSurface, | ||
| int | waveNumber, | ||
| double | X, | ||
| double | Y, | ||
| double | Z, | ||
| double | L, | ||
| double | M, | ||
| double | N, | ||
| out int | ErrorCode, | ||
| out int | vignetteCode, | ||
| out double | exro, | ||
| out double | exio, | ||
| out double | eyro, | ||
| out double | eyio, | ||
| out double | ezro, | ||
| out double | ezio, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateDirectPol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. Ex ex. Ey ey. phaX phase x. phaY phase y. startSurface The start surface. toSurface To surface. waveNumber The wave number. X x. Y y. Z z. L l. M m. N n. ErrorCode The error code. vignetteCode The vignette code. exro exro. exio exio. eyro eyro. eyio eyio. ezro ezro. ezio ezio. intensity The intensity.
- Returns
◆ SingleRayDirectPolFull()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayDirectPolFull | ( | RaysType | rayType, |
| double | Ex, | ||
| double | Ey, | ||
| double | phaX, | ||
| double | phaY, | ||
| int | startSurface, | ||
| int | toSurface, | ||
| int | waveNumber, | ||
| double | X, | ||
| double | Y, | ||
| double | Z, | ||
| double | L, | ||
| double | M, | ||
| double | N, | ||
| out int | ErrorCode, | ||
| out int | vignetteCode, | ||
| out double | xo, | ||
| out double | yo, | ||
| out double | zo, | ||
| out double | lo, | ||
| out double | mo, | ||
| out double | no, | ||
| out double | exro, | ||
| out double | exio, | ||
| out double | eyro, | ||
| out double | eyio, | ||
| out double | ezro, | ||
| out double | ezio, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateDirectPol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. Ex ex. Ey ey. phaX phase x. phaY phase y. startSurface The start surface. toSurface To surface. waveNumber The wave number. X x. Y y. Z z. L l. M m. N n. ErrorCode The error code. vignetteCode The vignette code. xo output x. yo output y. zo output z. lo output l. mo output m. no output n. exro output exr. exio output exi. eyro output eyr. eyio output eyi. ezro output ezr. ezio output ezi. intensity The intensity.
- Returns
◆ SingleRayDirectUnpol()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayDirectUnpol | ( | RaysType | rayType, |
| int | startSurface, | ||
| int | toSurface, | ||
| int | waveNumber, | ||
| double | X, | ||
| double | Y, | ||
| double | Z, | ||
| double | L, | ||
| double | M, | ||
| double | N, | ||
| out int | ErrorCode, | ||
| out int | vignetteCode, | ||
| out double | xo, | ||
| out double | yo, | ||
| out double | zo, | ||
| out double | lo, | ||
| out double | mo, | ||
| out double | no, | ||
| out double | l2o, | ||
| out double | m2o, | ||
| out double | n2o, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateDirectUnpol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. startSurface The start surface. toSurface To surface. waveNumber The wave number. X x. Y y. Z z. L l. M m. N n. ErrorCode The error code. vignetteCode The vignette code. xo xo. yo yo. zo zo. lo lo. mo mo. no no. l2o l2o. m2o m2o. n2o n2o. intensity The intensity.
- Returns
◆ SingleRayNormPol()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayNormPol | ( | RaysType | rayType, |
| double | Ex, | ||
| double | Ey, | ||
| double | phaX, | ||
| double | phaY, | ||
| int | toSurf, | ||
| int | waveNumber, | ||
| double | Hx, | ||
| double | Hy, | ||
| double | Px, | ||
| double | Py, | ||
| double | exr, | ||
| double | exi, | ||
| double | eyr, | ||
| double | eyi, | ||
| double | ezr, | ||
| double | ezi, | ||
| out int | ErrorCode, | ||
| out double | exro, | ||
| out double | exio, | ||
| out double | eyro, | ||
| out double | eyio, | ||
| out double | ezro, | ||
| out double | ezio, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateNormPol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. Ex ex. Ey ey. phaX phase x. phaY phase y. toSurf To surf. waveNumber The wave number. Hx hx. Hy hy. Px px. Py py. exr exr. exi exi. eyr eyr. eyi eyi. ezr ezr. ezi ezi. ErrorCode The error code. exro exro. exio exio. eyro eyro. eyio eyio. ezro ezro. ezio ezio. intensity The intensity.
- Returns
◆ SingleRayNormPolFull()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayNormPolFull | ( | RaysType | rayType, |
| double | Ex, | ||
| double | Ey, | ||
| double | phaX, | ||
| double | phaY, | ||
| int | toSurf, | ||
| int | waveNumber, | ||
| double | Hx, | ||
| double | Hy, | ||
| double | Px, | ||
| double | Py, | ||
| double | exr, | ||
| double | exi, | ||
| double | eyr, | ||
| double | eyi, | ||
| double | ezr, | ||
| double | ezi, | ||
| out int | ErrorCode, | ||
| out double | xo, | ||
| out double | yo, | ||
| out double | zo, | ||
| out double | lo, | ||
| out double | mo, | ||
| out double | no, | ||
| out double | exro, | ||
| out double | exio, | ||
| out double | eyro, | ||
| out double | eyio, | ||
| out double | ezro, | ||
| out double | ezio, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateNormPol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. Ex ex. Ey ey. phaX phase x. phaY phase y. toSurf To surf. waveNumber The wave number. Hx hx. Hy hy. Px px. Py py. exr exr. exi exi. eyr eyr. eyi eyi. ezr ezr. ezi ezi. ErrorCode The error code. xo output x. yo output y. zo output z. lo output l. mo output m. no output n. exro output exr. exio output exi. eyro output eyr. eyio output eyi. ezro output ezr. ezio output ezi. intensity The intensity.
- Returns
◆ SingleRayNormUnpol()
| bool ZOSAPI.Tools.RayTrace.IBatchRayTrace.SingleRayNormUnpol | ( | RaysType | rayType, |
| int | toSurf, | ||
| int | waveNumber, | ||
| double | Hx, | ||
| double | Hy, | ||
| double | Px, | ||
| double | Py, | ||
| bool | calcOPD, | ||
| out int | ErrorCode, | ||
| out int | vignetteCode, | ||
| out double | xo, | ||
| out double | yo, | ||
| out double | zo, | ||
| out double | lo, | ||
| out double | mo, | ||
| out double | no, | ||
| out double | l2o, | ||
| out double | m2o, | ||
| out double | n2o, | ||
| out double | opd, | ||
| out double | intensity | ||
| ) |
Performs the same calculation as CreateNormUnpol, but for one ray at a time.
- Parameters
-
rayType Type of the ray. toSurf To surf. waveNumber The wave number. Hx hx. Hy hy. Px px. Py py. calcOPD if set to truethe Optical Path Difference will be calculated. Note that this can only be done when tracing rays to the Image surface.ErrorCode The error code. vignetteCode The vignette code. xo xo. yo yo. zo zo. lo lo. mo mo. no no. l2o l2o. m2o m2o. n2o n2o. opd The OPD, if calculated. intensity The intensity.
- Returns
Public Member Functions inherited from