Navigation: Scripting Reference Manual > Functions & Subroutines > AddSourceDirIthMultiAngle

 

AddSourceDirIthMultiAngle

 

Contact Us: fredsupport@photonengr.com

 

Description

For a source node with a ray direction type, "Multiple source angles (plane waves)", this function adds an angle specification to the source's existing ray direction list.  The function returns the index into the list at which the new specification was added.

 

Syntax

idx = AddSourceDirIthMultiAngle( src, xAng, yAng, bActive )

 

Parameters

idx (Long)

Returned by the function and indicates the index into the ray direction list at which the new specification was added.

 

src As Long

Node number of the source being modified.

 

xAng As Double

X angle in degrees along which the rays will propagate.

 

yAng As Double

Y angle in degrees along which the rays will propagate

 

bActive As Boolean

Indicates whether this angle specification is active or inactive.  When inactive, no rays will be generated along the specified direction.

 

 

Example

The example below shows how to replace the existing list of angles in a source node with a rectilinear grid of directions in angle space.

 

Sub Main

 

    'Source node being modified

    Dim src As Long

    src = FindFullName( "Optical Sources.Multi Angle Source" )

 

    'Grid of angles we want to create

    Dim xMin As Double, xMax As Double

    Dim yMin As Double, yMax As Double

    Dim nX As Long, nY As Long

    xMin = -10 : xMax = 10

    yMin = -20 : yMax = 20

    nX   = 3

    nY   = 3

 

    'Derive angle step

    Dim xStep As Double, yStep As Double

    xStep = (xMax - xMin)/(nX-1)

    yStep = (yMax - yMin)/(nY-1)

 

    'Delete existing angles

    Dim curAng As Long, nAng As Long

    nAng = GetSourceDirMultiAngleCount( src )

    For curAng = nAng-1 To 0 Step -1

        DeleteSourceDirIthMultiAngle( src, curAng )

    Next

 

    'Print Header row

    Print ""

    Print "Entry" & Chr(9) & "X (deg)" & Chr(9) & "Y (deg)"

 

    'Add new angle(s)

    Dim curX As Long, curY As Long, ithAng As Long

    Dim xAng As Double, yAng As Double

    For curX = 0 To nX-1

        For curY = 0 To nY-1

            xAng   = xMin + xStep*curX

            yAng   = yMin + yStep*curY

            ithAng = AddSourceDirIthMultiAngle( src, xAng, yAng, True )

            Print ithAng;

            Print xAng;

            Print yAng

        Next

    Next

 

    Update

 

End Sub

 

See Also

Source Script Commands

InsertSourceDirIthMultiAngle

DeleteSourceDirIthMultiAngle

IsSourceDirMultiAngle

SetSourceDirMultiAngle

SetSourceDirIthMultiAngle

SetSourceDirIthMultiAngleActive

GetSourceDirMultiAngleCount

GetSourceDirIthMultiAngle

GetSourceDirIthMultiAngleActive

 

 

 

 

 

 

Copyright © Photon Engineering, LLC