Description This subroutine populates a T_RAY structure variable with member values for the current ray being traced in the ray buffer. The companion SetTracingRay routine can then be used to apply a modified T_RAY structure on 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.
Syntax GetTracingRay tRay
Parameters tRay As T_RAY Data structure variable whose members are populated with the property values of the current ray 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
|