Description This function uses an existing analysis surface to compute the wavefront of a scalar field and stores the resulting wavefront data in an Analysis Results Node (ARN). Only coherent, unpolarized rays are considered in this analysis.
Syntax nRays = WavefrontToARN( anaNode, arnName, arn )
Parameters nRays (Long or Huge_) Returned number of rays included in the Wavefront calculation.
anaNode As Long Node number of the analysis surface whose grid specification and ray selection criteria will be applied in the Wavefront calculation.
arnName As String Name of the resulting wavefront ARN being created.
arn As Long Passed in as an argument, this variable will contain the node number of the wavefront ARN after the function executes.
Example The example below calls a raytrace and then performs a wavefront calculation of the coherent, scalar field and sends the result to an ARN. The resulting wavefront ARN is then decomposed to Zernike terms and the coefficients are reported in the output window.
Sub Main
'Document prep DeleteRays() ARNDeleteAllNodes()
Dim src As Long, ana As Long, wfimager As Long src = FindFullName( "Optical Sources.Plane Wave (coherent) 1" ) ana = FindFullName( "Analysis Surface(s).Wavefront Grid" )
'Perform raytrace and complex field analysis CreateSource( src ) TraceExisting()
'Wavefront analysis and decomposition Dim maxCoef As Long, curCoef As Long, wfArn As Long Dim coefs() As Double, xcen As Double, ycen As Double, xsemi As Double, ysemi As Double Dim isWaves As Boolean Dim zstring As String isWaves = True maxCoef = 15 xcen = 0.0 ycen = 0.0 xsemi = 3.1 ysemi = 3.1 WavefrontToARN( ana, "Wavefront", wfArn ) 'Data has units of Waves ARNDecomposeToZernikes( wfArn, xcen, ycen, xsemi, ysemi, maxCoef, isWaves, coefs() )
'Reporting Print "" Print "Zernike decomposition result:" Print "" & Chr(9) & "Term" & Chr(9) & "Coef (" & If(isWaves,"waves",GetUnits()) & ")" & Chr(9) & "Form" For curCoef = 0 To UBound(coefs) Print Chr(9); Print curCoef; Print coefs(curCoef); Print GetZernikeSurfIthTermText( curCoef ) Next
'Display the ARN in a chart window ARNDisplayInChart( wfArn, "" )
End Sub
See Also
|