Navigation: Scripting Reference Manual > Functions & Subroutines > AddDiffuseBinomialFromFile

 

AddDiffuseBinomialFromFile

 

Contact Us: fredsupport@photonengr.com

 

Description

This function adds a diffuse binomial scatter model to the FRED document using a text file as the source defining the parameters and coefficients.

 

 

Syntax

nScatter = AddDiffuseBinomialFromFile( fName, tDiff, dCoefs( ) )

 

 

Parameters

nScatter As Long

Returned index number of the scatter model that was added to the document.

 

fName As String

Full path name to the file from which the scatter model is being created.  See the diffuse binomial help topic for a description of the file format specification.

 

tDiff As T_DIFFUSEBINOMIAL

Data structure defining the generic parameters of the scatter model being added.  The structure members n, m, l, lp and D are overridden by the contents of the text file.  After the function is executed, the values in structure members n, m, l, lp and D will reflect the contents of the text file.

 

dCoefs() As Double

This array variable is passed into the function call as an argument.  If the function call is successful, then dCoefs() stores the values of the coefficients from the text file.

 

 

Example

The following example initializes a T_DIFFUSEBINOMIAL data structure, adds a diffuse binomial model scatter model to the document and then prints out a summary of the model that was added.

 

Sub Main

 

    Dim tDiff As T_DIFFUSEBINOMIAL

    Dim coefs() As Double

    Dim fName As String

    Dim sNode As Long

    Dim curCoef As Double

 

    fName = "C:\temp\SampleDiffuseBinomialModel.txt"

 

    InitDiffuseBinomial( tDiff )

        tDiff.name = "Sample diffuse binomial from file"

    sNode = AddDiffuseBinomialFromFile( fName, tDiff, coefs() )

 

    Print "Diffuse Binomial scatter model added at node " & sNode

    Print "Parameters:"

    Print Chr(9) & "n = " & tDiff.n

    Print Chr(9) & "m = " & tDiff.m

    Print Chr(9) & "l = " & tDiff.L

    Print Chr(9) & "lp= " & tDiff.lp

    Print Chr(9) & "D = " & tDiff.D

    Print Chr(9) & "mode = " & tDiff.lMode

    Print "Coefficients:"

    For Each curCoef In coefs()

        Print Chr(9) & curCoef

    Next

 

End Sub

 

 

See Also

T_DIFFUSEBINOMIAL 

InitDiffuseBinomial 

GetDiffuseBinomial

SetDiffuseBinomial

AddDiffuseBinomial

 

 

 

 

 

Copyright © Photon Engineering, LLC