Description This function queries a specific ray to retrieve the state of the ray's active flag. A ray must be active in order to be raytraced or included in an analysis. 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 isActive = IsRayActive ( id )
Parameters isActive (Boolean) Returned value indicating whether a ray is active. If True, the ray is active. If False, the ray is not active. id As Long (or Huge_) Ray ID number.
Example The example below demonstrates how to trace any active sources, loop over the rays and then print the active and live ray status flag for each ray.
Sub Main
ClearOutputWindow() EnableTextPrinting(True)
'Trace active sources EnableTextPrinting(False) TraceCreateDraw() EnableTextPrinting(True)
'Header Print "Ray ID" & Chr(9) & "Active?" & Chr(9) & "Live?"
'Loop over the ray buffer and print the active and live status for each ray Dim success As Boolean Dim rayId As Long Dim tRay As T_RAY success = GetFirstRay( rayId, tRay ) While success
Print rayId & Chr(9) & IsRayActive( rayId ) & Chr(9) & IsRayLive( rayId )
tRay.a = -tRay.a tRay.b = -tRay.b tRay.c = -tRay.c SetRay( rayId, tRay ) success = GetNextRay( rayId, tRay ) Wend
End Sub
See Also
|