Description This subroutine changes the ray direction specification of a source to the type, "Randomly according to intensity distribution", and uses a file to specify the polar and azimuth reference vectors and populate the table with intensity data. This subroutine does not change the number of random rays generated per ray position, so that parameter will have to be set using the SetSourceDirSampledPolar subroutine. The Randomly According to Intensity Distribution help topic provides the text file format specification required.
Syntax SetSourceDirSampledPolarImportFile( srcNode, fileName )
Parameters srcNode As Long Node number of the source whose ray direction specification is being modified.
fileName As String Full path to the file being used to set the polar and azimuth reference vectors as well as the intensity table.
Example The example below demonstrates how to create a source node, use file data to specify the source's randomly according to intensity distribution ray direction settings and then update the number of rays being generated according to the intensity distribution per ray position.
Sub Main
'Create the source node Dim srcNode As Long Dim tEnt As T_ENTITY InitEntity( tEnt ) tEnt.name = "According to Intensity" srcNode = AddSource( tEnt )
'Set the positions grid to be 1x1 rays Dim xSemi As Double, ySemi As Double, xNum As Long, yNum As Long, isEllipse As Boolean GetSourcePosGrid( srcNode, xSemi, ySemi, xNum, yNum, isEllipse ) xNum = 1 yNum = 1 SetSourcePosGrid( srcNode, xSemi, ySemi, xNum, yNum, isEllipse )
'Specify that the source use the ray direction type, "Random according to intensity distribution" 'by loading the distribution from a properly formatted text file Dim fName As String fName = "C:\temp\sourceIntensityDistribution.txt" SetSourceDirSampledPolarImportFile( srcNode, fName )
'Now lets retrieve some of the ray direction parameters, then reset the number of rays being generated Dim nRays As Long, data() As Double Dim xAzi As Double, yAzi As Double, zAzi As Double Dim xPolar As Double, yPolar As Double, zPolar As Double GetSourceDirSampledPolar( srcNode, nRays, data(), xAzi, yAzi, zAzi, xPolar, yPolar, zPolar ) nRays = 1000000 SetSourceDirSampledPolar( srcNode, nRays, data(), xAzi, yAzi, zAzi, xPolar, yPolar, zPolar )
'Udpate the FRED document Update
End Sub
See Also
|