Description This subroutine takes a T_RAY structure variable and applies the member values to the current ray being traced in the ray buffer. The companion routine, GetTracingRay, can be used to populate a T_RAY structure for the current ray being traced in the ray buffer. The intended use of GetTracingRay and SetTracingRay is with scripted coatings, scatterers and materials, when the default input and output variables do not allow for the flexibility that a user needs in a given calculation.
The user is cautioned against changing the wavelength for coherent rays by a significant amount. Due to the fact that the construction of the gaussian beamlets depends on the ray wavelength, altering the wavelength significantly can lead to inaccurate propagation of the coherent ray.
Syntax SetTracingRay tRay
Parameters tRay As T_RAY Data structure variable whose members values are being used to set the properties of the ray that is currently being traced in the ray buffer.
Example The example below shows how to apply the GetTracingRay and SetTracingRay subroutines in the context of a user-defined script coating. Using these commands allows a straightforward method for implementing a spatially varying coating transmission function. In this example, the variation is quadratic in the ray's normalized radial position.
Sub EvalCoating( ByVal g_x#, ByVal g_y#, ByVal g_z#, ByVal g_cos#, ByVal g_w#, ByVal g_n0#, ByVal g_n1#, ByVal g_k0#, ByVal g_k1#, ByVal g_refl As Boolean, ByRef g_magS#, ByRef g_magP#, ByRef g_phsS#, ByRef g_phsP# )
Dim rNorm As Double rNorm = 5.0
Dim r2 As Double r2 = g_x^2 + g_y^2
Dim rFrac As Double rFrac = r2 / rNorm^2
Dim transVal As Double transVal = 1.0 - rFrac^2
'Modify ray power directly Dim tRay As T_RAY GetTracingRay( tRay ) tRay.power = tRay.power * transVal SetTracingRay( tRay )
'Apply constant 1.0 transmission coating so we don't double apodize the ray power g_magS = 1.0 g_magP = 1.0 g_phsS = 0.0 g_phsP = 0.0
End Sub
See Also
|