Navigation: Scripting Reference Manual > Functions & Subroutines > GetRayDiffractDepth

 

GetRayDiffractDepth

 

Contact Us: fredsupport@photonengr.com

 

Description

This function queries a ray for its diffraction event counter, which indicates the number of interactions a ray has had with a diffraction grating.  Depending on the number of rays traced, it may be necessary to dimension ray index and ray counter variables as data type Huge_ instead of Long.  Please see Multi-threaded Raytracing for more information.

 

 

Syntax

dCount = GetRayDiffractDepth( rayID )

 

 

Parameters

dCount (Long)

Diffraction event counter for the ray being queried.  The diffraction event counter for a ray is incremented every time a ray undergoes a diffraction event at a grating surface.

 

rayID As Long (or Huge_)

The ray ID number for the ray whose diffraction event count is being queried.

 

 

 

Example

The following example loops over all rays in the buffer, checks their diffraction event count and reports information to the output window.  The intent would be to find the ray ID numbers for rays with more than one diffraction event.

 

Sub Main

 

    Dim tRay As T_RAY

    Dim curRay As Long, dCount As Long

    Dim success As Boolean

 

    Print "Ray ID" & vbTab & "Diffract Count"

 

    success = GetFirstRay( curRay, tRay )

    While success

        dCount = GetRayDiffractDepth( curRay )

        If dCount > 1 Then

            Print curRay;

            Print dCount

        End If

        success = GetNextRay( curRay, tRay )

    Wend

 

End Sub

 

 

See Also

GetDotProdSurfTrim

 

 

 

 

 

Copyright © Photon Engineering, LLC